Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 26th, 2006, 06:41 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default User control ID collision

I have a user control that is loaded and added to my page through a container and the LoadControl method:

while(!done)
{
MyControl myControl = (MyControl) LoadControl("mycontrol.ascx");
placeholderContainer.Controls.Add(myControl);
}

The problem arises when I click on of the LinkButtons in my user control. ASP.NET replies with an error message saying that one or more of my server controls have the same ID.

Even though I assign a unique ID though the ID property to all my controls in the user control AND to the myControl in the example above I still get the error message.

How do asp.net assign the IDs? Especially when controls are nested and have IDs like:

TreeView$pnltreeNode$TreeNodeIcon

The line above is from my code, and I doesn't get a single match when I use the find function to search after the string "pnltreeNode" (case sensitive).

Is this a bug?

  #2 (permalink)  
Old May 26th, 2006, 08:00 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have to manually apply a unique value to myControl AFTER adding it to my container control.

That solves the problem.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session ID swapping from user to user... greenwar VS.NET 2002/2003 3 September 7th, 2007 08:44 AM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
what is the password and user id for ........! Random Servlets 1 November 8th, 2005 02:59 AM
User ID Validation Ramakrishna ADO.NET 3 November 30th, 2004 07:53 AM
User Control Id not working duncanthescott Pro VB.NET 2002/2003 4 September 23rd, 2003 11:44 AM



All times are GMT -4. The time now is 03:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.