Read Only Rows

2 posts, 0 answers
  1. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 29 Jul 2010 Link to this post

    Is there a way to make some rows readonly and other editable? Even better would be on the individual cell level.

    I have the following scenario. I have a list of items that I need to display both horizontally, which is the normal grid behaviour, and vertically.

    To accomplish this I have to build a datatable dynamically based on which option is selected. (horizontal or vertical).

    When horizontal is selected I do not have a problem because I can set columns to be readonly. However when I display the data vertically I need the top row, with the exception of the first column which now acts as the headers, to be editable and all other rows to be readonly. I have attached screen shots to demonstrate


    Billy Jacobs
  2. Maya
    Maya avatar
    4062 posts

    Posted 30 Jul 2010 Link to this post

    Hi Billy Jacobs,

    A possible approach in your case would be to use the BeginningEdit event of the grid and enable or disable the edit-mode for the columns/ rows you need. For example:

    private void playersGrid_BeginningEdit(object sender, Telerik.Windows.Controls.GridViewBeginningEditRoutedEventArgs e)
                GridViewRow row = e.Row as GridViewRow;
                if (e.Cell.Column == this.playersGrid.Columns[0] || row.Item as Player == this.playersGrid.Items[0] as Player)
                    e.Cancel = false;
                    e.Cancel = true;

    In this way only the first row and the first column will be editable.

    Sincerely yours,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top