Carpas
Carpas

Reputation: 11

Update a text box in the aspx page with data from aspx.vb page

I'm trying to pass data from aspx.vb page to the aspx page.

At the aspx.vb page i put a value(0 or 1) in the textbox that is runat="server"

and when the aspx page is loaded i check

example:

if($("#myTextBox").val() == "0"){
   .....
   ......
}

At the first time when the page is loaded things are correct(the text box is empty as supposed to be)

but from the 2nd time and on... the checking of the text box value isn't correct (and i know that the value is correct and is in the text box)...the javascript doesn't recognize it.

hope it can help.....thanks

Upvotes: 1

Views: 165

Answers (1)

Samuel
Samuel

Reputation: 1159

Try this

if($("#<%=myTextBox.ClientID %>").val() == "0"){
   .....
   ......
}

You need to use #<%=myTextBox.ClientID %> for the JQuery get the correctly the DOM´s id

Upvotes: 1

Related Questions