G
Guest
I'm moving from years with the datagrid to a new project, .net 2.0, using
GridView controls. Per past practice, it is often a lot easier to inject
controls (or special formatting) in RowDataBound (formerly ItemDataBound)
than to mess with complicated templates, especially for things that are
consistent across grids or columns. GridView is dumping all the nice stuff
put there during a RowDataBound event.
Ex: those "!" icons in outlook or classification (confidential) markings on
a row-by-row basis. In the datagrid, this worked not just well, but very
well. Once in the grid, it stayed in the grid, including postbacks from other
controls.
Now the GridView simplifies a lot of stuff like sorting, but it also wants
to invoke the DataBinding (and DataBound) event for any postback - a (new
item) button, a calendar, parent-child-linked-down bunch of dropdown lists,
whatever.
The GridView doesn't remember what what was done in RowDataBound - dumps
everything. Is there an easy way to not have it bind when the postback is
caused by a non-GridView control? Or force it to just re-bind everything? The
values of the bound columns are all there after postback - but that's all.
If I have to go to templates I will, but that means I can't re-use stuff in
nice objects/classes/common static methods (which way varies with use), which
is a much cleaner approach in the long run.
If anybody knows a nice shortcut, please speak up.
GridView controls. Per past practice, it is often a lot easier to inject
controls (or special formatting) in RowDataBound (formerly ItemDataBound)
than to mess with complicated templates, especially for things that are
consistent across grids or columns. GridView is dumping all the nice stuff
put there during a RowDataBound event.
Ex: those "!" icons in outlook or classification (confidential) markings on
a row-by-row basis. In the datagrid, this worked not just well, but very
well. Once in the grid, it stayed in the grid, including postbacks from other
controls.
Now the GridView simplifies a lot of stuff like sorting, but it also wants
to invoke the DataBinding (and DataBound) event for any postback - a (new
item) button, a calendar, parent-child-linked-down bunch of dropdown lists,
whatever.
The GridView doesn't remember what what was done in RowDataBound - dumps
everything. Is there an easy way to not have it bind when the postback is
caused by a non-GridView control? Or force it to just re-bind everything? The
values of the bound columns are all there after postback - but that's all.
If I have to go to templates I will, but that means I can't re-use stuff in
nice objects/classes/common static methods (which way varies with use), which
is a much cleaner approach in the long run.
If anybody knows a nice shortcut, please speak up.