Change GridView to EditMode when creating new row

2 posts, 1 answers
  1. Jeff
    Jeff avatar
    2 posts
    Member since:
    Feb 2016

    Posted 25 Mar Link to this post

    I have a gridview with 10 columns, only one is editable when not a new row. When I create a NewRow, I want that row to be editable. We've tried many different ways, but we can't get it to work. Any help would be welcome.

     

    Thanks,

    Jeff

  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 28 Mar Link to this post

    Hi Jeff,

    Thank you for writing.

    You can use the CellBeginEdit method to cancel the edit operation for particular cells/columns. The following snippet shows how you can disable the data rows editing (the new row would be editable) for two columns: 
    private void RadGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
        if (e.Row is GridViewDataRowInfo)
        {
            if (e.Column.Name == "Name" || e.Column.Name == "Date")
            {
                e.Cancel = true;
            }
        }
    }

    Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top