Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / September 2003

Tip: Looking for answers? Try searching our database.

Control IDs reverse?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JW - 22 Sep 2003 19:12 GMT
I have a WebControl, lets call it WebC. WebC has a Label control, with
an ID of TheLabel. I have a UserControl, lets call it UserC. I drop
WebC onto UserC; WebC has an ID of "WebC1" and the Label on WebC1 now
has an ID of "WebC1_TheLabel". I drop UserC onto a page; UserC has an
ID of "UserC1" and the Label on WebC1 now has an ID of
"UserC1_WebC1_MyLabel". From within the WebC code, there is an area
that writes the Label control's ID [e.g. this.Attributes.Add(
"onmouseover", "jsfunction('" + this._theLabel.ID + "');"]. Okay, so
when the control renders the onmouseover event SHOULD look something
like this:

onmouseover="jsfunction('UserC1_WebC1_MyLabel');"

But instead it comes out like this:

onmouseover="jsfunction('WebC1_UserC1_MyLabel');"

It reverses WebC1 with UserC1 in the naming container. Why does this
happen and how do you correct it?

-James
James Williams - 22 Sep 2003 20:27 GMT
I answered my own question. I needed to use ClientID instead ID.

> I have a WebControl, lets call it WebC. WebC has a Label control, with
> an ID of TheLabel. I have a UserControl, lets call it UserC. I drop
[quoted text clipped - 17 lines]
>
> -James

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.