Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem binding datagrid in Page_PreRender

Status
Not open for further replies.

JustBarno

Programmer
Jun 21, 2004
46
0
0
US
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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top