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 / Web Controls / December 2004

Tip: Looking for answers? Try searching our database.

cannot find the user control with it's ID

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Davids - 26 Dec 2004 09:56 GMT
I have this simple user control having a Datalist with id="MyDataList" in my
page but I can't find it using the Page.FindControl() method. So I set the
trace mode on and I see it is there but since it is placed under a panel
control which automatically has the id "ctrl02" my user control is
"ctrl02$MyDataList"

Why is that?!?!
Edge - 26 Dec 2004 18:22 GMT
> I have this simple user control having a Datalist with
> id="MyDataList" in my page but I can't find it using the
[quoted text clipped - 4 lines]
>
> Why is that?!?!

Very simple: otherwise you would get a duplicate ID
(MyDataList) when you add your control to the page twice.

Signature

Edge

Davids - 27 Dec 2004 19:55 GMT
well I can't understand that since I choose the ID and so it would be my
mistake?! How the heck can I find the control with Page.Findcontrol() if
.Net suffixes my ID with some random name??

>> I have this simple user control having a Datalist with
>> id="MyDataList" in my page but I can't find it using the
[quoted text clipped - 7 lines]
> Very simple: otherwise you would get a duplicate ID
> (MyDataList) when you add your control to the page twice.
Ben Strackany - 27 Dec 2004 23:04 GMT
Yeah, you won't be able to find a control within another control.

Assuming you put a user control with an ID of MyUserControl in the page, you
might be able to have your page's code use
MyUserControl.FindControl("MyDataList").

Signature

Ben Strackany
www.developmentnow.com

> well I can't understand that since I choose the ID and so it would be my
> mistake?! How the heck can I find the control with Page.Findcontrol() if
[quoted text clipped - 11 lines]
> > Very simple: otherwise you would get a duplicate ID
> > (MyDataList) when you add your control to the page twice.

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



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