106
rated 0 times
[
108]
[
2]
/ answers: 1 / hits: 66335
/ 11 Years ago, mon, april 22, 2013, 12:00:00
I have ASP.Net page where i am calling a JavaScript function like this:
Enter server name: <asp:TextBox ID=txt_name runat=server></asp:TextBox>
<asp:Button ID=btn_view runat=server OnClick=View_btn_click OnClientClick=return AlertOnGo('View Configuration',document.getElementById('<%= txt_name.ClientID %>').value) Text =GO! />
But on clicking the GO button, i am getting the following error:
JavaScript runtime error: Unable to get property 'value' of undefined or null reference
On viewing the rendered code for the button:
<input type=submit name=btn_view value=GO! onclick=return AlertOnGo('View Configuration',document.getElementById('<%= txt_name.ClientID %>').value); id=btn_view />
It is not putting the appropriate ClientID. I tried setting the CLientIDMode to static for the test box, yet no help.
This question is similar to this unanswered question.
More From » asp.net