473,327 Members | 2,071 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,327 software developers and data experts.

ClientID

JJ
Hi,

Can anyone advise me how is the ClientID issued?
I had a suite Controls which consist of a context menu (i.e. a group of
tables, rows and cells situated in a class library) and a set of buttons. I
am doing dynamic HTML which I only know how many buttons and context menu to
create on the fly.

Next I had written a simple JAvascript which will allow the dialogs (i.e.
the context menu's tables) to be placed at the correct location when
mouseover event is activated. But I got strange ClientIDs return to me. When
the page is reloaded using the button click event, the clientID of the menu
table's table is in the form of ID. But when the page is activated via a
click event of the table cell in the class library, the the clientID will now
be __clt0_+"ID";

Why is it this way, how asp.net issue clientID to the controls?

Many Thanks!
Nov 19 '05 #1
2 1754
I'm not exactly sure what you mean by the different client IDs, can you post
an example of the different behavior?

In the meantime, here's some basic information on the ClientID property from
http://msdn.microsoft.com/library/de...ntIDTopic.asp:

<snip>
ASP.NET automatically generates a ClientID for a server control regardless
of whether you have specified an ID property for it or not. This property is
used to identify a control for client-side operations, such as ECMAScript
functions.
Any name you assign to a server control using the ID property overrides the
value of this property.
</snip>

Maybe you aren't assigning an ID to the control on that other case? If you
post some code, that will really help.

--

Joshua Mitts
jo****@msn.com
"JJ" <JJ@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Hi,

Can anyone advise me how is the ClientID issued?
I had a suite Controls which consist of a context menu (i.e. a group of
tables, rows and cells situated in a class library) and a set of buttons.
I
am doing dynamic HTML which I only know how many buttons and context menu
to
create on the fly.

Next I had written a simple JAvascript which will allow the dialogs (i.e.
the context menu's tables) to be placed at the correct location when
mouseover event is activated. But I got strange ClientIDs return to me.
When
the page is reloaded using the button click event, the clientID of the
menu
table's table is in the form of ID. But when the page is activated via a
click event of the table cell in the class library, the the clientID will
now
be __clt0_+"ID";

Why is it this way, how asp.net issue clientID to the controls?

Many Thanks!

Nov 19 '05 #2
JJ
Hi Josh,

I know what went wrong already. The ClientID is generated by ASP.NET. When
building controls within controls, the clientID will be
parentcontrol.clientID + ID. This appending of IDs wil ensure that the
clientID for a particular control is unique and it also shows the hierarchy
of the controls.

I made a mistake as I took the clientID before adding the control to the
parent. Hence the clientID will be the normal ID value we set for the
control. The appending of the parentID will only happen when
parent.controls.add(control) is called.

Thanks! and sorry for the confusion.

"Josh Mitts" wrote:
I'm not exactly sure what you mean by the different client IDs, can you post
an example of the different behavior?

In the meantime, here's some basic information on the ClientID property from
http://msdn.microsoft.com/library/de...ntIDTopic.asp:

<snip>
ASP.NET automatically generates a ClientID for a server control regardless
of whether you have specified an ID property for it or not. This property is
used to identify a control for client-side operations, such as ECMAScript
functions.
Any name you assign to a server control using the ID property overrides the
value of this property.
</snip>

Maybe you aren't assigning an ID to the control on that other case? If you
post some code, that will really help.

--

Joshua Mitts
jo****@msn.com
"JJ" <JJ@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
Hi,

Can anyone advise me how is the ClientID issued?
I had a suite Controls which consist of a context menu (i.e. a group of
tables, rows and cells situated in a class library) and a set of buttons.
I
am doing dynamic HTML which I only know how many buttons and context menu
to
create on the fly.

Next I had written a simple JAvascript which will allow the dialogs (i.e.
the context menu's tables) to be placed at the correct location when
mouseover event is activated. But I got strange ClientIDs return to me.
When
the page is reloaded using the button click event, the clientID of the
menu
table's table is in the form of ID. But when the page is activated via a
click event of the table cell in the class library, the the clientID will
now
be __clt0_+"ID";

Why is it this way, how asp.net issue clientID to the controls?

Many Thanks!


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Maras | last post by:
Hello, as we know VB is not case sensivity. I have a following problem, I have to send to another server few parametrs by post or get method, one of them MUST be a "clientID", it's preety...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
2
by: Neo Geshel | last post by:
After pouring over about a dozen sites that clearly dealt with ClientID all by itself, I came to the realization that about 2/3+ of them were doing it wrong. It is indeed impossible to grab the...
2
by: Neo Geshel | last post by:
After pouring over about a dozen sites that clearly dealt with ClientID all by itself, I came to the realization that about 2/3+ of them were doing it wrong. It is indeed impossible to grab the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.