How do I maintain list of controls across posts for a WebControl?

K

Ken Varn

I have created a custom control that derives from WebControl. The custom
control assigns other controls dynamically to the Controls collection. Is
there anyway that I can recall the lost of controls that I assigned to my
custom control when I receive postback?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
 
K

Kevin Spencer

Keep track of what Controls are being added, and persist that data somewhere
(such as ViewState). Then, on PostBack, read from your "list" and re-add the
appropriate Controls.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
K

Ken Varn

I thought about doing it that way, but it seemed like a lot of redundant
data. I end up sending the same stuff twice to the client. Maybe it isn't
significant enough to worry about it. I was trying to keep my ViewState
data down to a minimum.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
Kevin Spencer said:
Keep track of what Controls are being added, and persist that data somewhere
(such as ViewState). Then, on PostBack, read from your "list" and re-add the
appropriate Controls.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
K

Ken Varn

This seems like redundant data. If I put it in ViewState, I am duplicating
the data that is already on the screen. Can I somehow have the controls
post back with the form?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
Kevin Spencer said:
Keep track of what Controls are being added, and persist that data somewhere
(such as ViewState). Then, on PostBack, read from your "list" and re-add the
appropriate Controls.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top