Force validation on Checkbox clicked

3 posts, 1 answers
  1. VaL
    VaL avatar
    30 posts
    Member since:
    Oct 2017

    Posted 31 Aug 2018 Link to this post

    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. VaL
    VaL avatar
    30 posts
    Member since:
    Oct 2017

    Posted 31 Aug 2018 Link to this post

    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.

  3. Answer
    Dimitar
    Admin
    Dimitar avatar
    2841 posts

    Posted 03 Sep 2018 Link to this post

    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 onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top