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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iterate through datagrid in edit mode

Status
Not open for further replies.

slatet

Programmer
Sep 11, 2003
116
US
Does anyone have suggestions on how to handle the following?

We have a grid that binds to an class that contains a datetime object. When the datetime is null we set it to System.Data.SqlTypes.SqlDateTime.MinValue.Value. When the datetime is equivalent to this value, we make the cell blank for display. But when we are editing a row, the MinValue displays again for all rows except the one we are editing. Once you hit update, it goes back to a blank field.

What we need some help with is how to iterate through the grid and make this field blank during the edit. If we try and do

foreach( DataGridItem GridItem in ctrlDataGrid.Items )

we get an error on the field that we are editing for the field we are trying to modify.

Or if anyone knows how to make a datetime property of an object null that would be helpful too. We have not been able to find a way to do this by searching online.

Thank you in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top