This is a migrated thread and some comments may be shown as answers.

Force validation on Checkbox clicked

2 Answers 192 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 31 Aug 2018, 12:39 PM

Hi, 

I'm struggling for something that perhaps is very easy...

I have assigned a DataTable as Datasource for my GridView.

The data is correcly shown and the boolean values are mapped on checkboxes.

I save back the values to the database getting the new values from the DataTable.

However sometimes the user open the form, click on checkboxed value, and then click on the Save button.

It seems that if you don't deselect the modified Row, the new value of the checkbox is not stored into the DataTable, so I save the old value, while in the GridView you see the new value.

Is there a way to force the sync right after the click on the checkbox?

I've tried with something like this, but without success.

private void RadGridView1OnCellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
            e.ActiveEditor.EndEdit();
            e.ActiveEditor.Validate();
}

2 Answers, 1 is accepted

Sort by
0
Andrea
Top achievements
Rank 1
answered on 31 Aug 2018, 12:54 PM

Great, the best way to find a solution is to write on the forum: in two minutes I found what I've been looking for hours.

I was forgetting to set:

GridViewCheckBoxColumn.EditMode = EditMode.OnValueChange

to the column. Now it works.

0
Accepted
Dimitar
Telerik team
answered on 03 Sep 2018, 07:42 AM
Hi Valerio,

Yes, this is the correct way to solve this. Do not hesitate to contact us if you have other questions.

Regards,
Dimitar
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Andrea
Top achievements
Rank 1
Answers by
Andrea
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or