Another Multiple Control error

M

Mike Smith

I am attempting to create a dynamic multi-level tab strip from a
database using linkbuttons. I can get the controls added to the page on
the first page load, but on post back I get the mutiple control error.
I have read other postings, but none seem to give the right answer for
my case.

Do I need to cache the items on the first load so that I am not hitting
the database again or is there a way to only load this information once?

Thank you for your help.

Mike
 
J

John Saunders

Mike Smith said:
I am attempting to create a dynamic multi-level tab strip from a
database using linkbuttons. I can get the controls added to the page on
the first page load, but on post back I get the mutiple control error.
I have read other postings, but none seem to give the right answer for
my case.

Do I need to cache the items on the first load so that I am not hitting
the database again or is there a way to only load this information once?

Mike, you haven't really given enough information about this problem. For
instance, what specific "multiple control error" are you receiving, and
exactly where are you getting it (please provide the stack trace).

I'm guessing that you may be receiving an error about multiple controls with
the same ID. If that's the case, you're probably getting it when you're
adding your LinkButtons. If so, you should ask why the link buttons are
already present in their parent's Controls collection. As a brute force
method, you could use Controls.Clear before adding any LinkButtons.

If you're creating a composite control, take a look at the following
pattern. If you follow this pattern and create the child controls (the link
buttons) in the CreateChildControls method, then you shouldn't have a
problem:

Developing a Composite Control
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/ht
ml/cpcondevelopingcompositecontrols.asp)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top