Groups | Blog | Home
all groups > asp.net > may 2004 >

asp.net : Difference between ID, ClientID and UniqueID?


Henri
5/17/2004 11:25:55 PM
Sorry to post so many questions but if you could tell me the difference
between these 3 IDs, it would help me a lot.
I don't know which one to use inside my custom control...


Henri
5/18/2004 2:18:31 AM
Thanks for your explanation Darren :-)
"Darren Clark" <dclark88@hotmail.com> a =E9crit dans le message de =
news:ODW0RbGPEHA.2452@TK2MSFTNGP11.phx.gbl...
ID is the id that you control is called.

ClientID is the ID that gets written to the html page. This works =
like such=20
ParentIControlID_myControlID
So if you have a ascx page.. caled myJobs and you have a label called =
myLabel
then the output to the page would be=20
<span id=3D"myJobs_myLabel">


UniqueID (Not sure how to explain... so here is the MDSN stuff)
For example, if you include an ASP.NET Label Web server control in a =
Repeater server control, and assign the Label control an ID property =
value of MyLabel, and the Repeater an ID of MyRepeater. If you bind data =
to the Repeater to an ArrayList object with three entries, the resulting =
UniqueID properties for each instance of the Label server controls are =
MyRepeater:ctl0:MyLabel, MyRepeater:Ctl1:MyLabel, and =
MyRepeater:Ctl2:MyLabel.






[quoted text, click to view]
Darren Clark
5/18/2004 9:28:50 AM
ID is the id that you control is called.

ClientID is the ID that gets written to the html page. This works like =
such=20
ParentIControlID_myControlID
So if you have a ascx page.. caled myJobs and you have a label called =
myLabel
then the output to the page would be=20
<span id=3D"myJobs_myLabel">


UniqueID (Not sure how to explain... so here is the MDSN stuff)
For example, if you include an ASP.NET Label Web server control in a =
Repeater server control, and assign the Label control an ID property =
value of MyLabel, and the Repeater an ID of MyRepeater. If you bind data =
to the Repeater to an ArrayList object with three entries, the resulting =
UniqueID properties for each instance of the Label server controls are =
MyRepeater:ctl0:MyLabel, MyRepeater:Ctl1:MyLabel, and =
MyRepeater:Ctl2:MyLabel.






[quoted text, click to view]
AddThis Social Bookmark Button