Retrieving client side control value using servre VB.NET

  • Thread starter Thread starter Kevin Humphreys
  • Start date Start date
K

Kevin Humphreys

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

Thanks,
Kevin.
 
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
 
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.
 
Back
Top