Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple controls with the same ID

Status
Not open for further replies.

cossiboon

Programmer
Dec 12, 2000
25
US
Hello,
On a web form, I dynamically create some panels at run-time which all have unique ids. The first time the page is loaded, it works great. If I refresh or navigate out and come back I get the following error.

Multiple controls with the same ID 'pnlQuestionHeader12968' were found. FindControl requires that controls have unique IDs.

After doing a little bit of toying around, I noticed that if every panel added to the web form has a unique id everytime it's refreshed, the panels are added ... again. Meaning, two of the same panels on the web form.

Anybody?

josh
 
do you have the dynamic code in the code-behind or the html...if the code-behind make sure you have it within a

if not page.ispostback then
dynamic loading..
end if
 
Hello,
Thanks for the prompt response. I understand your idea here, although I'm not posting to the server, only refreshing (F5).

josh
 
you should specifically set the controls ID when you create them dinamically because each time they are created, they get a new ID.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top