This is a migrated thread and some comments may be shown as answers.

Keep items in edit mode through page change

6 Answers 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 03 Sep 2009, 09:25 AM
Here's my scenario: I have a master table with some items in it. Through the push of a button, you can choose to edit an item's sub-items. This expands the item, and populates the sub-items, setting each item's Edit=true, and works just fine. However, some items have tons of sub-items, so paging is necessary. When one changes the page, the new items that show up are not in Edit-mode. How do I keep them in edit mode while still allowing paging?

6 Answers, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
answered on 03 Sep 2009, 04:34 PM
Usually helpful Telerik, where are you? I really need to find an answer to this.
0
Alexander
Top achievements
Rank 1
answered on 04 Sep 2009, 09:52 AM
Anyone?
0
Mira
Telerik team
answered on 04 Sep 2009, 02:58 PM
Hello Alexander,

Usually the edit mode of the items is not kept when changing the page - please take a look at this demo. I recommend that you save it using an approach similar to the approach in the Persisting the selected rows server-side on sorting/paging/filtering/grouping help topic.

Kind regards,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Peter
Top achievements
Rank 1
answered on 01 May 2012, 07:59 AM
I have a grid where I always want every row to be editable - I got it working, but not when I start paging.The demo doesn't help and the persisting article refers to row selection. Looping through the grid during Pre_Render only seems to provide "IsInEditMode" for the GridItem/GridDataItem which is read-only.

This code fires for Page 1 but doesn't work on subsequent pages (the event seems to fire before PageIndexChanged):
protected void rgGrid_DataBinding(object sender, EventArgs e)
        {
            for (int i = 0; i < rgGrid.MasterTableView.PageSize; i++)
            {
                rgGrid.EditIndexes.Add(i);
            }
        }

This code fires on PreRender, but doesn't seem to work:

protected void rgGrid_PreRender(object sender, EventArgs e)
        {
            for (int i = 0; i < rgGrid.MasterTableView.PageSize; i++)
            {
                rgGrid.EditIndexes.Add(i);            
            }
        }


How do I maintain editing while paging?

Additional info:

<telerik:RadGrid AllowMultiRowEdit="true"  ...
<MasterTableView EditMode="InPlace"  AllowPaging="true" AllowCustomPaging="false"...

PageIndexChanged rebinds grid by fetching the data from cache and then setting "DataSource" and calling "DataBind()". 
0
Shinu
Top achievements
Rank 2
answered on 02 May 2012, 05:04 AM
Hello Peter,

Please try rebinding the RadGrid after putting the items in edit mode.
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
 for (int i = 0; i < RadGrid1.PageSize; i++)
 {
    RadGrid1.EditIndexes.Add(count);
 }
  RadGrid1.Rebind();
}

Thanks,
Shinu.
0
Peter
Top achievements
Rank 1
answered on 02 May 2012, 05:54 AM
Yes thanks Shinu, I just worked that out before - not sure how I missed it.
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Alexander
Top achievements
Rank 1
Mira
Telerik team
Peter
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or