Validating Row in winforms GFrid

2 posts, 0 answers
  1. yaron
    yaron avatar
    1 posts
    Member since:
    Jun 2015

    Posted 25 Jun 2018 Link to this post


    I am very confused with validating data before sending it to the DB. 

    My Grid is popultated with datatable (from Web service) and I would like to send row data each time the user finishes to edit the row (send via Web Service) and also I would like to send a new row data by using a web service call with the params as needed. 

    The proble is that I do not know wich event to use sa there are a lot. 

    I tried to use grid_RowsChanged but I do not know if I should also use RowValidating as rows_Changed occured before row_valdating. or should I use only rows_changed? there is also a user_added_row event... please help.. 

    I want to let user finish add new row then check if everything is valid. If it is not valid I would like to prevent him from pushing data (rovalidating is the only way I have to cancel telerik grid action to add the new row or accept the current row changes. 

    It is very consfusing, could you please help me. 



  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4131 posts

    Posted 25 Jun 2018 Link to this post

    Hello, Yaron,   

    RadGridView provides a convenient way to perform validation before data is committed to the underlying data source. You can validate data by handling CellValidating event which is raised by RadGridView when the current cell changes or when the cell loses input focus (when pressing Enter key). Canceling this event prevents the user from exiting the cell until a valid editor value is entered or the edit process is canceled. The RowValidating event can be used the same way to prevent the user from exiting the current row. However, the editor will be closed in this case and the value will be committed to the underlying data source. Additional information is available in the following help article:

    In order to validate the new row's data, it is suitable to handle the UserAddingRow event. This help article gives additional information about the new row:

    Here are demonstrated several events how to update the external data source. Feel free to use this one which suits your requirement best:

    I hope this information helps. If you have any additional questions, please let me know. 

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top