Validating

5 posts, 0 answers
  1. Veljko Janjic
    Veljko Janjic avatar
    20 posts
    Member since:
    Nov 2005

    Posted 26 Dec 2007 Link to this post

    Can you describe the concept of custom validating of cell content in your GridView. When using validating event I can't figure out what is the cell (its ColumnInfo or RowInfo) which is in edit mode and its content. Why don't args have more properties such as cellElement or columnindex, rowindex ...

    Thanks in advance.
  2. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 28 Dec 2007 Link to this post

    Hi Veljko Janjic,

    Thank you for writing.

    The validation mechanism is currently based on the Validating/Validated events of System.Windows.Forms.Control class. The arguments of RadGridView.Validating event are of type ValueChangingEventArgs but there are no members pointing to the column or row of the edited cell.

    Currently, the only way the column and row of the edited cell can be accessed in the event handlers of these events are the following: 

    GridViewDataColumn column = radGridView1.MasterGridViewTemplate.CurrentColumn as GridViewDataColumn;
    GridViewDataRowInfo row = radGridView1.CurrentRow as GridViewDataRowInfo;

    Most probably, the RadGridView API and behavior regarding data validation will be updated and expanded in the upcoming release of our controls.

    If you have any additional questions, please contact us again.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Veljko Janjic
    Veljko Janjic avatar
    20 posts
    Member since:
    Nov 2005

    Posted 29 Dec 2007 Link to this post

    I'm not sure that's the proper way since, user can be in edit mode and when he clicks on some other cell validating event is fired but CurrentRow and CurrentColumn infos are of the latter cell.

    I resolved validating issue by passing values to my classes as strings and my classes then validate input, but from the point of long term solution I'm not satisffied with this. I don't want to burden bussines logic classes with formatting issues.

    BTW. How can I update group sums after editing some cells? Which event is best for updating the sums and which command should be executed?

    Best regards.
  5. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 02 Jan 2008 Link to this post

    Hello Veljko Janjic,

    Indeed, in case the user clicks on the other cell and the Validating event is fired, the CurrentColumn refers to the previous cell (CurrentRow is ok). This appears to be an issue and it is logged to be fixed in the next version. Of course, you should not have to mess the validation logic with your business logic. As another workaround I would suggest hooking the RadGridView.MouseDown event where you could get the current column corresponding to the cell being edited.

    In response to your question about grouping, try calling the UpdateGroupPanel method when the new value is validated like this:

    void radGridView1_Validated(object sender, EventArgs e)  
    {  
        radGridView1.UpdateGroupPanel();  

    Thank you for bringing this issue to our attention. Your telerik point balance has been updated.

    If you have any further questions, we will be glad to assist you.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 03 Jan 2008 Link to this post

    Hello Veljko Janjic,

    Just a quick follow-up. As another workaround for the issue related to the Validating event, I would suggest getting the current column when the editing begins. You could save the reference to the column in the CellBeginEdit event handler and use it later in the Validating event handler.

    Contact us again if further questions arise.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for WinForms is Visual Studio 2017 Ready