Thursday, 17 July 2014

Multiple controls with the same ID '_header' were found. FindControl requires that controls have unique IDs. in Asp.net

7/17/2014 - By Pranav Singh 0

This article will explain your when your get the error “Multiple controls with the same ID '_header' were found. FindControl requires that controls have unique IDs.” What will be the solution for resolving this error. This error I face while dynamically adding accordion pan at run time of ajaccontroltoolkit.

So here is the screen shot of the error.



So here is the cod for which I have faced this error.

AccordionPane ap1 = new AccordionPane();
ap1.HeaderContainer.Controls.Add(new LiteralControl("Using Markup"));
ap1.ContentContainer.Controls.Add(new LiteralControl("Adding panes using markup is really simple."));
AccordionPane ap2 = new AccordionPane();
ap2.HeaderContainer.Controls.Add(new LiteralControl("Using Code"));
ap2.ContentContainer.Controls.Add(new LiteralControl("Adding panes using code is really flexible."));
Accordion1.Panes.Add(ap1);
Accordion1.Panes.Add(ap2);

Now as per error we are getting same id for the control which we are adding at run time.

So here is the solution you just needed to add the id for each and every pan control.

AccordionPane ap1 = new AccordionPane();
ap1.ID = "ap1";
ap1.HeaderContainer.Controls.Add(new LiteralControl("Using Markup"));
ap1.ContentContainer.Controls.Add(new LiteralControl("Adding panes using markup is really simple."));
AccordionPane ap2 = new AccordionPane();
ap2.ID = "ap2";
ap2.HeaderContainer.Controls.Add(new LiteralControl("Using Code"));
ap2.ContentContainer.Controls.Add(new LiteralControl("Adding panes using code is really flexible."));
Accordion1.Panes.Add(ap1);
Accordion1.Panes.Add(ap2);

Just check the bold part of the code. now run the page you will not get the error.


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top