if i add a row with a date cell how can i set the date to default to now(). there are 2 options
1: set it to now() when the user starts to add the row so it's pre-populated
2: set it to now() if the user forgets to do it.
I prefer #1
Peter
howudodat said:1: set it to now() when the user starts to add the row so it's pre-populated
How you do this depends on how the new rows are added. If you are adding them in code or using the AddNew buttons, then you might use the AfterRowInsert event. If you are using TemplateAddRows, then you could use the DefaultCellValue property or InitializeTemplateAddRow events.
If your data source supports it, you might be able to set the DefaultValue on the field or column.
Hi Peter,
You can use the BeforeRowUpdate event of the Grid, this will be the second solution:
private void ultraGrid1_BeforeRowUpdate(object sender, CancelableRowEventArgs e) { e.Row.Cells[index].Value = DateTime.Now; }
Magued