Jeremy Wadsworth
My Contribution to the ASP.NET Community


Welcome   
Welcome to my personal website. Here you will find blog posts related to web development as well as personal related interests. If you're here for the source code to my Personal Web Site Kit, please register and you'll receive an email when your account has been approved.


Latest Blog Entries

 Wednesday, September 12, 2007


Multiple controls with the same ID were found. FindControl requires that controls have unique IDs.    
This error gets thrown and looks something like Multiple controls with the same ID 'myControl1' were found. FindControl requires that controls have unique IDs.

This error typically occurs when trying to dynamically add or remove controls during the initial load of a page or a postback. You might hit a button and instead of a postback, you get this error. If you're getting this error and you're trying to add or remove controls from the page dynamically, you are most likely adding/removing after something has already been added to viewstate.

The key here is to do your add/remove before things like binding of other controls. Try adding or removing the control in the Page_Init. It might take a little creativity in your code to get the sequence correct.


jeremy at 10:16 PM | (17) Comments | Add a comment | Permalink





Commments
az said...

Hi, spent an hour struggling with this and after several searches your simple answer prompted me to move some code and have it fixed 2 minutes later. Thanks much. And yes, I was both adding and removing controls dynamically and using ajax.

Thursday, May 01, 2008 2:43 PM

Bheeks said...

mind sharing what you did?

Wednesday, August 20, 2008 1:48 AM

Ufuk Demirci said...

i have that problem too, and after this small explanation i just put me.ispostback= true (vb.net) and it works!!! many many thanks, you're great.

Thursday, March 26, 2009 4:37 AM

Kashif said...

You need to give the unique id to the dynamically added controls. This can be done as below. Dim rn As New Random() SVCMsgControl.ID = rn.Next().ToString() ServiceMessagesPlaceHolder.Controls.Add(SVCMsgControl) Hope it helps!!

Friday, March 27, 2009 7:04 AM

Tan Anwar said...

I tried setting up the ID before adding the control to the container but it didn't help my cause. I am trying to add two RadEdit's to a page dynamically from code behind. Any of you have any other solution regarding this?

Tuesday, November 03, 2009 7:45 AM

jeremy said...

Have a look at this post in the telerik forums. http://www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-exception-multiple-controls-with-the-same-id-page-were-found.aspx

Tuesday, November 03, 2009 5:05 PM

Duane Wingett said...

Hi, One of our clients has experienced this issue once on a site that has controls dynamically added during an AJA callback. The controls are given consecutive dynamic IDs before they are added. I cannot get it to occur at all, but will bear in mind what has previously been above.

Thursday, November 12, 2009 3:44 AM

Tiffany jewellery said...

I cannot get it to occur at all, but will bear in mind what has previously been above.

Friday, July 16, 2010 9:22 PM

Herve Leger said...

An online shop specializing in Herve Leger, Herve Leger Dress, Herve Leger Skirt, <a href='http://www.hervelegerbrand.com'>Herve Leger</a> <a href='http://www.hervelegerbrand.com'>Herve Leger Dress</a> Herve Leger Sale, Herve Leger Dresses.All new style in our store. <a href='http://www.hervelegerbrand.com'>Herve Leger Dresses</a> <a href='http://www.hervelegerbrand.com'>Herve Leger Sale</a> FashionStyleOnsale offer high quality Moncler Jackets at low price. Moncler Jackets on sale, shop more discount Moncler Vest, Moncler Coats at FashionStyleOnsale <a href='http://www.fashionstyleonsale.com'>Moncler</a> <a href='http://www.fashionstyleonsale.com'>Moncler Jackets</a> <a href='http://www.fashionstyleonsale.com'>Moncler Vest</a> <a href='http://www.fashionstyleonsale.com'>Moncler Coats</a> <a href='http://www.fashionstyleonsale.com'>coats</a> <a href='http://www.fashionstyleonsale.com'>mens jackets</a> <a href='http://www.fashionstyleonsale.com'>womens jacket</a> <a href='http://www.fashionstyleonsale.com'>ugg</a>

Monday, August 02, 2010 3:10 AM

wholesale nfl jerseys said...

[url=http://www.jerseysusa.com]Cheap jerseys[/url] [url=http://www.jerseysusa.com]Wholesale jerseys[/url]

Wednesday, August 18, 2010 8:48 PM

wholesale nfl jerseys said...

[url=http://www.jerseysusa.com]Cheap jerseys[/url] [url=http://www.jerseysusa.com]Wholesale jerseys[/url]

Wednesday, August 18, 2010 8:49 PM

Herve Leger said...

Are you always vexed about wearing what kind of dress at a banquet? Herve Leger bandage dress online store eliminates your worries. Ladies who is beautiful and noble may choose Herve Leger bandage dress. The dress highlights your perfect feminine body curve. If you wear this dress, it will send out your inherent glamour. It is specially designed for you and meets your noble taste. Wherever you go, you will be the focus. If you haven't a suitable dress to attend a banquet and want to buy one now, Herve Leger bandage dress online store is your best choice http://www.buyherveleger.net/

Thursday, August 19, 2010 6:57 AM

true religion jeans said...

[URL=http://www.supplyjeanjeans.com] true religion on sale [/URL] [URL=http://www.supplyjeanjeans.com/true-religion-jeans-true-religion-men-short-jeans-c-16_42.html] true religion billy jeans [/URL]

Friday, August 20, 2010 3:22 AM

cheap purses said...

[URL=http://www.goodluckbags.com] fake gucci [/URL] [URL=http://www.goodluckbags.com] gucci handbags [/URL]

Friday, August 20, 2010 3:24 AM

Cheap lv bags on sale said...

[URL=http://www.worldtophandbags.com/category-724-b0-juicy-handbags.html] juicy couture handbags [/URL] [URL=http://www.worldtophandbags.com/category-724-b0-juicy-handbags.html] wholesale juicy couture handbags [/URL]

Friday, August 20, 2010 3:24 AM

MBT shoes said...

<p><a href="http://www.exmbt.com">MBT shoes</a> (which stands for Masai Barefoot Technology) footwear actually helps you work the muscles in your legs and body while you walk.These specially designed shoes alter your stride in a way that makes your steps cleaner and your posture more upright.How do <a href="http://www.exmbt.com">discount mbt shoes</a> work?Imagine if you were trying to balance a ball under your foot. You can envision how this would make the muscles in your feet and legs work harder.That's the basic idea behind MBT products.With each step,your heel "rolls" your leg forward, which stretches out your calf muscles.When you straighten your body,the rotation starts shifting your balance to the middle of your foot.Then when you step through,you feel your back muscles tense.In this manner,MBT <a href="http://www.exmbt.com">healthy shoes</a> help improve your gait and your posture - step after step after step!<br> If you want to know more things about MBT shoes,welcome to <a href="http://www.exmbt.com/blog">mbt shoes blog</a>.</p>

Tuesday, August 24, 2010 9:21 PM

GHD said...

That's a very good post! I have learnt so much from this post! And I will tell my friends this website. Thanx for your sharing.

Saturday, August 28, 2010 4:27 AM

  Leave a comment

Enter Your Name:
 
Enter your website
Security code from image below:  
Need Custom Controls Work or Training?
   


Join WebHost4Life.com






If you would like to help support this project, please click the button below to make a small donation.