Clientid Clientid

Here in this post we will see how we can get clientID of an server side control at client end.

for demo purpose I have created simple page that contains TextBox web control and one html submit button.
On click event of submit button I'm calling Javascript function called xx() that displays value entered in TextBox control

'<%=TextBox1.ClientID%>'  This way we will get Server side control clientId.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns="" >


<title>Untitled Page</title>


function xx()


var msg = document.getElementById('<%=TextBox1.ClientID%>').value;







<form id="form1" runat="server">


<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox></div>

<input id="Submit1" type="submit" value="submit" onclick="xx();" />

</form> </body>


Tags: Interview Questions for 2 years or 3 years experianceasp net image 2.0 step by step Membership Provider File HandlingJQuery Set Value of Textbox or Label Control In Asp.netWhat is web garden in Convert String To Convert Image To Base64Hack open new windowListBox Binding csharp


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.