Radgrid - Put certain rows in edit mode

5 posts, 0 answers
  1. Ramesh
    Ramesh avatar
    3 posts
    Member since:
    Mar 2012

    Posted 12 Apr 2012 Link to this post

    I am trying to set certain rows on my grid in edit mode automatically on page load based on the content of one of the columns. I have seen some examples on this forum where either all rows are automatically put into edit mode during PreRender or by manually selecting multiple rows and firing a command event.

    Please provide some examples on how certain rows can be automatically be put in edit mode during page load.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Apr 2012 Link to this post

    Hello Ramesh,

    Try the following code to achieve your scenario.
    C#:
    protected void grid1_PreRender(object sender, EventArgs e)
    {
     if (!IsPostBack)
     {
       foreach (GridItem item in grid1.MasterTableView.Items)
       {
         if (item is GridEditableItem)
         {
           GridEditableItem editableItem = item as GridDataItem;
           TableCell cell = (TableCell)editableItem["UniqueName"];
           if (cell.Text == "Text")
           {
             editableItem.Edit = true;
           }
         }
       }
        grid1.Rebind();
     }
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ray
    Ray avatar
    10 posts
    Member since:
    Jun 2014

    Posted 28 Oct 2015 in reply to Princy Link to this post

    Hi Princy,

    Is there some setting that must be in place for this to work?  It executes the "editableItem.Edit = true;" line for every row in my grid but only the last one stays in edit mode.

    It is as if when it puts each row in edit mode, it takes the previous row out of edit mode, leaving the last row in edit mode.

    Thanks,

    Ray

  5. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 02 Nov 2015 Link to this post

    Hello Ray,

    You will also need to enable the AllowMultiRowEdit property in the main RadGrid tag.
    Hope this helps. Please give it a try and let me know if it works for you.

    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  6. Ray
    Ray avatar
    10 posts
    Member since:
    Jun 2014

    Posted 03 Nov 2015 in reply to Eyup Link to this post

    Hi Eyup,

    Yes, this worked.  Thank you!!

     Ray

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017