Reputation: 195
I have a gridview which is databound and lets say that i have got around 20 rows in gridview while running. The gridview also has checkboxes for each rows and if i click only particular rows using checkbox the following operation should be performed using c# asp.net and linq.
The fields in gridview are name,area,problem,status,date and time.if i check the checkbox for some rows, the values (name,date and time) of selected rows should be matched with the values in database and in database the status column should be updated with 'completed' value and the remaining unselected rows should be matched similarly with database values and should update the status as 'pending'...
Please help me solve this situation..
Upvotes: 0
Views: 379
Reputation: 1335
Events CellBeginEdit
and CellEndEdit
Usage:
public object CurrentCellValue;
private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
CurrentCellValue = dataGridView[e.ColumnIndex, e.RowIndex].Value;
}
private void dataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
var cellVaue = dataGridView[e.ColumnIndex, e.RowIndex].Value;
if (!ValidateTime(cellVaue.ToString()))
dataGridView[e.ColumnIndex, e.RowIndex].Value = CurrentCellValue;
}
Upvotes: 1