Problem with binding in Page_PreRender

P

PokerJoker

I have narrowed my problem quite a bit but am still having issues making a
work around.

I am using a datagrid to display a 2d matrix of users and security levels.
Different applications have their own applicable security zones, so the
columns are genereated dynamically with checkboxes to give permissions, for
example...

.............level1.......level2.....level3.....level4......remove
Joe.........chk...........chk........chk.........chk.......remove
Bob.........chk...........chk........chk.........chk.......remove
Steve......chk...........chk........chk.........chk.......remove

The form also has a dropdown of available users to add to the grid. Because
Page_Load is run before the button event to add a user, I moved to code to
build the security matrix and bind the grid into Page_PreRender so that newly
added users will be in the database before the bind occurs.

The grid itself "looks" like it is working fine. The new user is added to
the grid, and the correct rows/columns are displaying AOK.

The problem is that, when I loop through the grid to grab the checkbox
values, using the following code

For Each item In myGrid.Items
.....
Next

It skips right over the block, like the grid has no rows. All I need to do
to make the code work fine, is move the binding of the grid into page_load
instead of preRender. This is unacceptable because of the issue I described
above.

Is there a more accepted work around that I'm not aware of? Or perhaps a
different way to get the button submit event to run before the grid gets
bound and retain the state properly on the server?

Thanks!
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top