Getting Dynamically Create Control Values

  • Thread starter Thread starter GregoryJ
  • Start date Start date
G

GregoryJ

I have a web page that Dynamically creates a CheckBox control for each Role
(Forms Authentication) a User belongs to and sets the .Checked property to
TRUE if they belong to the Role.

Displaying this controls works exactly as I wish. Now, I want to allow users
the ability to place a check in any of these Roles and add them to the
necessary Role based on those Check Box that are checked off. But, when my
Save routine is fired off the Dynamic controls don’t seem to exist and thus I
am not able to retrieve the new values a person has applied to the fields.

How can I read the value of a dynamically created check box control during a
PostBack. This would be the check boxes the user has clicked off since the
page was originally posted.
 
GregoryJ said:
I have a web page that Dynamically creates a CheckBox control for each Role
(Forms Authentication) a User belongs to and sets the .Checked property to
TRUE if they belong to the Role.

Displaying this controls works exactly as I wish. Now, I want to allow
users
the ability to place a check in any of these Roles and add them to the
necessary Role based on those Check Box that are checked off. But, when my
Save routine is fired off the Dynamic controls don’t seem to exist and
thus I
am not able to retrieve the new values a person has applied to the fields.

How can I read the value of a dynamically created check box control during
a
PostBack. This would be the check boxes the user has clicked off since the
page was originally posted.

From where are the controls missing - in a new "processing page" or in the
code behind? Also, where are you placing the dynamically created controls?
If inside a table, it could be that you need to go a 1 level deeper to
"find" the controls. If you could please strip down your code and post it, I
would be happy to take a look.

I know this might seem obvious, but are you looking for the dynamic controls
in the page load and if so, are you putting your logic behind a:
if (! this.IsPostBack)
{
....
}

Craig
 
Back
Top