|
-
Apr 9th, 2007, 10:21 AM
#1
Thread Starter
New Member
Programmatically-added user controls misbehaving
Hi all,
I'm using ASP.Net 1.1 / VB2003. I wrote a user control (ascx), which has a checkbox, a user-enterable textbox, a label, and a linkbutton. I have a page which programmatically pulls in about a dozen of these ascx's depending on the database, placing them at a PlaceHolder inside a Panel. This is done in a sub I call from Page_Init, which is where 2 web sites warned me I had to do it.
For any number of the displayed user controls, I can check off the checkbox, enter a comment in the textbox, and click the page's SAVE button. I have the logic you'd expect: a FOR loop going thru the controls in the PlaceHolder.Controls collection, seeing if the myCtl.Checked is True, and updating the comment to the database. So far so good... everything initially comes up great, and updates the database.
The problem is, when the page is redisplayed, my checkmark and typed-in comment are still displayed at the point on the page that I typed 'em in at. This despite the fact that when the page is redisplayed a temporary javascript alert msgbox shows me that there are zero of my ascx controls at the placeholder (I had a controls.clear for a while anyway), and I the sub reloads all of the controls with their checked's = False and Comment's = "".
Does anybody know what I might be missing, or if there's a way to force the display of the page to reflect the controls that have actually been loaded?
(And, I'm curious, why is my collection of user controls being cleared out on every page redisplay? EnableViewState=True for the ascx and all of its controls, plus my main page's panel & placeholder.)
I appreciate any help you might offer... thanks. LenexaKS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|