473,385 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 6478
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Crane Linkledder | last post by:
What is the difference, and when to use one over the other? Thanks
4
by: qtip | last post by:
I have a simple table the has First Name , Last Name, SSN, Date&Time. I have a report that will show all this information but I would like to put in at calculation to tell the difference between 2...
1
by: oafyuf | last post by:
Hi, I'm trying to learn ASP.NET by doing a pilot project: I have a DataGrid which contains a nested DataList. I want to iterate through the SQLDataReader for the DataGrid and populate each...
1
by: Kepler | last post by:
I have a custom control that is thrown onto a UserControl that is thrown onto a WebForm. Basically, I've got a scenario where if my UserControl sets an attribute on the custom control in the ascx,...
2
by: kw | last post by:
TextBox t=new TextBox(); Controls.Add(t); t.ID=t.ClientID; //reads: "_MyControl1__ctl16" And even in OnPreRender, I examine the Controls collection and verify that the ID of the TextBox is...
2
by: Ken Baltrinic | last post by:
Can someone explain this? I am writing an owner rendered User Control that basically wraps some functionality around a text box. This control uses client side javascript and implments...
7
by: Stoyan Stratev | last post by:
I have a control whose ClientID is used in a number of Javascript routines. It turned out that the ClientID has a dash (-) in it and breaks the JS. Is there a way to change the ClientID of that...
1
by: cannontrodder | last post by:
I am writing a composite control that allows two-way binding between a collection of boolean values and a set of checkboxes. In the CreateChildControls, I add each checkbox control that I need...
5
by: Monty | last post by:
I have an ASP.Net project I developed in VS2003 (ASP.Net 1.1) that works fine, but when I convert it to VS2005 (ASP.Net 2.0) it's behavior seems to change. I have the following datagrid in my...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.