473,699 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6492
ID is the id that you control is called.

ClientID is the ID that gets written to the html page. This works like such
ParentIControlI D_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_myLa bel">
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********@hot mail.com> wrote in message news:OD******** ********@TK2MSF TNGP12.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******@hotma il.com> a écrit dans le message de news:OD******** ******@TK2MSFTN GP11.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
ParentIControlI D_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_myLa bel">
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********@hot mail.com> wrote in message news:OD******** ********@TK2MSF TNGP12.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
5024
by: Crane Linkledder | last post by:
What is the difference, and when to use one over the other? Thanks
4
2638
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 Date&time stamps for the person. The report shows Last name, First Name and Date&Tiem Field. If the persone has 2 records I would like to show the amount of time between each in put.
1
2228
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 DataList by binding to a fresh SQLDataReader. At the moment I can only bind to the first instance of the DataList. If I could bind the data by the ClientID (or UniqueID), I'm sure it would work. Is there a way of doing this? Or maybe there is a better...
1
2313
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, EnsureChildControls gets called, creating the control before the UserControl is even added to the webform. The problem with this is that the UniqueID of the custom control will be false, since OnInit has yet to be called on its parent, somehow...
2
1914
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 "_MyControl1__ctl16". But then, on the final HTML rendered, if you look at the page, the textbox looks like this:
2
1706
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 IPostBackDataHandler. In order for my JaveScript to find the control using GetElementByID I must emit Control.ClientID as the value of the ID attribute of my textbox and in order for the postback handling mechanism to link up that same textbox with my...
7
1513
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 control?
1
3401
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 and give it a numbered id/name while setting it's checked property as per the values in my boolean collection. When I create the control on postback, I pull the datasource out of viewstate and re-create the checkboxes again with the data source...
5
2080
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 project: <asp:datagrid id="grid" runat="server" AutoGenerateColumns="False" AllowSorting="False" DataKeyField="myID"> <Columns> <asp:TemplateColumn HeaderText="Action"> <ItemTemplate> '''''''NOTE FOLLOWING LINE:
0
8689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8916
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8885
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7752
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.