javascript in asp.net 3.5

Posted by Pdsofty under JavaScript on 12/27/2010 | Points: 10 | Views : 2314 | Status : [Member] | Replies : 2
How to indentify asp.net server control in javasript??




Responses

Posted by: Lalji_mer on: 12/27/2010 [Member] Bronze | Points: 25

Up
0
Down
Show here code sample will help

 <script type="text/javascript" language="javascript">


function ctrl(ctrlname) //now you have the control name in the ctrlname. by refering this you can know which control is in focus
{
if (ctrlname==document.getElementById('<%= TextBox1.ClientID %>'))
{
alert('textbox1 is focus');
}
else if (ctrlname==document.getElementById('<%= TextBox2.ClientID %>'))
{
alert('textbox2 is focus');
}
}
</script>


<asp:TextBox ID="TextBox1" runat="server" onfocus="ctrl(this);"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" onfocus="ctrl(this);"></asp:TextBox>


Reference link
http://forums.asp.net/t/1272851.aspx

LP MER

Pdsofty, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/6/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Try this

http://opensource.devx.com/tips/Tip/28332

Thanks
Karthik
www.f5Debug.net

Pdsofty, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response