Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2006, 06:41 AM
Authorized User
 
Join Date: Mar 2005
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?

 
Old May 26th, 2006, 08:00 AM
Authorized User
 
Join Date: Mar 2005
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.






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





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