Home All Groups Group Topic Archive Search About

objects in GridView resets after databind,how to stop?

Author
27 Nov 2006 9:27 PM
JP
I have a grid view that I databind in code. Column 0 of this GridView is
hidden and the item template of this column contains hidden Label controls
with misc error messages.

When the user submits changes to the grid, any changes will be submitted.
However if the user attempts to add an item to the grid that already exist in
the grid, my Validate function will set GridView.Column[0].Visible = true;
it will then set the Label for the GridViewRow to visible so only that label
error message will show.

After I validate the changes and submit those that were successful, I rebind
the updated dataset back to the GridView. The problem is the Rebinding to the
grid appears to reset my label error message back to Visible = false. Yet the
Visible property of the GridView Column remains true after databind . I know
this is true, b/c as long as I don’t execute GridView.DataBind(), my label in
column[0] displays properly.


If my ViewStateEnable for the label is true, How do I prevent the visible
property of the label from being reset after databind? None of the items in
this hidden column are databound so this doesn’t make sense

Ideas? I hope this made sense

--
JP
..NET Software Developer

AddThis Social Bookmark Button