Forum Moderators: open

Message Too Old, No Replies

Get the value of a asp:TextBox

How to get the value before PostBack?

         

cayetanob

7:14 pm on May 24, 2005 (gmt 0)

10+ Year Member



Hi,

What I want to do is create a link to open a popup with the textbox value in the parameters. ej. index.php?var=(placas.text).

I have a TextBox like this:

<asp:TextBox ID="PLACAS" runat="server" TextMode="SingleLine" />

and I want to get the value of the texbox with this vb sentence:

= PLACAS.Text

It gives me the value right, but after it is postback. What I want to know is how to get the value before the form is postback?

Regards,
cayetano.

TheNige

8:23 pm on May 24, 2005 (gmt 0)

10+ Year Member



You will need to use client side scripting to get the value. Check out javascript or vbscript.

txbakers

8:41 pm on May 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



that's what I thought too, but the ASP:textBox element doesn't have a name before it is rendered. How can you use client side script, unless you use getElementByID.

mattglet

2:48 am on May 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you'd have to use client side JavaScript. Using the code above:

document.getElementById('PLACAS').value;

I'd just throw an onclick event in the link you're using, to popup the page that calls a function which uses window.open(), and also calls the textbox value.