468,765 Members | 1,335 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Difference between ID, ClientID and UniqueID?

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...

Nov 18 '05 #1
2 6300
ID is the id that you control is called.

ClientID is the ID that gets written to the html page. This works like such
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
<span id="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.


"Henri" <hm********@hotmail.com> wrote in message news:OD****************@TK2MSFTNGP12.phx.gbl...
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...


Nov 18 '05 #2
Thanks for your explanation Darren :-)
"Darren Clark" <dc******@hotmail.com> a écrit dans le message de news:OD**************@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
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
<span id="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.


"Henri" <hm********@hotmail.com> wrote in message news:OD****************@TK2MSFTNGP12.phx.gbl...
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...


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Crane Linkledder | last post: by
1 post views Thread by oafyuf | last post: by
2 posts views Thread by kw | last post: by
2 posts views Thread by Ken Baltrinic | last post: by
7 posts views Thread by Stoyan Stratev | last post: by
1 post views Thread by cannontrodder | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.