Read value of telerik radtextbox injavascript

shahjagat
shahjagat used Ask the Experts™
on
Hi,

I am trying to read the value of the radtext box. It comes out empty.

Anything wrong with this code?



var Addr1 = $find("<%= txtAddr1.ClientID %>");
addr1Text = Addr1.get_value();
alert("Addr1Text: " +  addr1Text );

 <telerik:RadTextBox ID="txtAddr1" runat="server" OnTextChanged="txtAddr1_TextChanged" AutoPostBack="false">
                </telerik:RadTextBox>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Ninja
Distinguished Expert 2018
Commented:
Hi shahJagat,

When you are executing your code? It looks bit odd. You have OnTextChanged but then AutoPostback is false.

As such, I would put a debug point above var Addr1 and check if I am actually getting the reference to underlying RadTextBox or not.
Your API usage get_value() is correct but we will have to see when you are executing the JavaScript.

Regards,
Chinmay.

Author

Commented:
Chinmay,

txtAddr1 is part of an address control(user control which also has addr2, city state)
When the onclientselectedindexchanged event of the radcombobox is fired, i want to capture all the values.
In this scenario, i can read the values of the city and state comboboxes. I am not able to get the value of the text box.

Thanks
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi Shahjagat,

Please post complete code, if possible, otherwise it is difficult to guess. Check your Browser's console, are you getting any errors? Also did you try putting a debug point and see what you are getting in Addr1?

Regards,
Chinmay.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial