Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
User Control Code(.ascx)

XML
<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
<input id="Button1" type="button" onclick="txtboxuserControl()" value="showtextboxcontentinalertmsg" />


Java Script is

XML
function txtboxuserControl()
{

var val=document.getElementById('<%= txtname.ClientID %>').value;
alert(val);

}



Please give the solution for that
Thanks ,
Chandrasekhar.K
Posted

do want to call the javascript function on click event if it is so then please use
OnClientClick="return txtboxuserControl();" 

instead of onclick()
 
Share this answer
 
Comments
Arun Jacob 7-Jul-10 7:24am    
Its for server control. What he's doing is right.
Can you try this,
<input id="Button1" type="button" onclick="txtboxuserControl('<%= txtname.ClientID %>')" value="showtextboxcontentinalertmsg" />

and
function txtboxuserControl(controlId)
{
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900