Adding New Row and Row changed Event

2 posts, 0 answers
  1. Claude
    Claude avatar
    39 posts
    Member since:
    Jun 2020

    Posted 23 Feb Link to this post

    When I click in the top row to type in a new row value, the CurrentRowChanged event is fired.  I have other code in this event, that I do not want to run when adding a new row.  So I need to trap this so the code will not run in the event.  I did not have this problem until I updated to the latest controls.  
  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4170 posts

    Posted 25 Feb Link to this post

    Hello, Claude,

    The CurrentRowChanged event is expected to be fired whenever the CurrentRow in RadGridView is changed. Hence, if you have a data row as current and you click the new row, the CurrentRowChanged event gets fired and the new row is current now.

    If you want your code not to be executed when the new row is clicked, you can check which row actually triggered the event:
            private void radGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
            {
                if (e.CurrentRow is GridViewDataRowInfo)
                {
                    //TODO
                    // execute your code here
                    Console.WriteLine("data row");
                }
            }

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top