Retrieving client side control value using servre VB.NET

K

Kevin Humphreys

Hi There,
Is it possible to retrieve a client side control value using server VB.NET?

Thanks,
Kevin.
 
S

Steve B.

use the classical document.getElementById(_id of your control_).

It is possible that you'll have to create the javascript method at the
client side. In this case, take a look at Page.ClientScripts object and the
ClientID property of the control to get its actual name at the client side

Steve
 
G

Gozirra

Yes. As a simple and brief example - If you have a textbox defined
with the name "htmlTextBox", then you can access that server side the
same way you would in classic asp.
<input type="text" name="htmlTextBox" value="fred" />
Request("htmlTextBox")

I generally find it easier to include runat="server" in the html
definition and then just access the controls like I would any other
serverside control.
<input type="text" runat="server" id="htmlTextBox" value="fred" />

Then in code you would define the variable like so.
Dim htmlTextBox As System.Web.UI.HtmlControls.HtmlInputText

But its up to you and your own preference.

Hope this was helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top