Masterpage and postback

J

Joseph James

Hi all,
I am very new to ASP.net. As I was going through new features of asp.net, I came across Masterpage and I tried to use it. But when I tried to access a control from client side java script (for postback purpose), I found that the controls name was changed (appended with ctl00_ContentPlaceHolder1_). Is there any way to find out the client name of the control at runtime dynamically?

Thanks in advance
 
B

Brock Allen

Yes, you want to use Control.ClientID in your javascript. So perhaps this:

<script>
function DoSomething()
{
document.findElementById('<%= myServerLabel.ClientID %>').innherHtml = "something";
}
</script>

-Brock
DevelopMentor
http://staff.develop.com/ballen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top