At what asp.net page event are clientIDs assigned?
Posted
by user191272
on Stack Overflow
See other posts from Stack Overflow
or by user191272
Published on 2010-06-15T20:17:24Z
Indexed on
2010/06/15
20:22 UTC
Read the original article
Hit count: 140
I want to do something like this:
Panel divPanel = new Panel();
divPanel.ID = "divPanel";
this.Page.Controls.Add(divPanel);
string script = "function alertID(){alert("the id is: "+divPanel.ClientID+");}";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scripttests", script);
But when I put this code in page_load, I don't get the full id, which is ctl00_ContentMain_divPanel, I just get divPanel.
Is there another event I should use? How do I make this work?
© Stack Overflow or respective owner