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

keeping edit mode

3 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Layo
Top achievements
Rank 1
Layo asked on 29 Oct 2012, 08:11 PM
hello
I need to know if it is possible to maintain the columns in edit mode,
without lost this mode when the page makes a
"pageLoad", because this is exactly what happens to me.
I can not put anything in the aspx of radgrid,
because it is a radgrid with autogenerated columns.


I put the columns in edit mode with the following method:

foreach (GridDataItem item in RadGrid1.Items)
        {
            item.Edit = true;
        }
        RadGrid1.MasterTableView.Rebind();



thank you very much

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Oct 2012, 05:13 AM
Hi,

I guess you want to make the entire Radgrid in edit mode on page load itself. Please try your code in the PreRender event.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    foreach (GridDataItem item in RadGrid1.Items)
    {
        item.Edit = true;
    }
    RadGrid1.MasterTableView.Rebind();
}

Please elaborate your scenario or provide code if it doesn't help.

Thanks,
Shinu.
0
Layo
Top achievements
Rank 1
answered on 30 Oct 2012, 12:34 PM
hi shinu.
I have that function in the PreRender Metod.
The problem is the rebind(), because that makes other databind.

this is the sequence

-Makes pageload
-Makes Databind
-Makes PreRender (here i call the function that put the columns in edit mode)
-Make DataBind (because previously I make a rebind)  

this sequence has brought me many problems in events like sorts, pagination, etc. becuase when makes the last databind i lost the sort or pagination, etc.
that is the reason of why I want to make the columns in edit mode once.

Thanks.


0
Shinu
Top achievements
Rank 2
answered on 31 Oct 2012, 06:54 AM
Hi,

Please try the following code snippet to make the RadGrid in Edit Mode on the page Load and remove edit on Paging/sorting.

CS:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        foreach (GridDataItem item in RadGrid1.Items)
        {
            item.Edit = true;
        }
        RadGrid1.MasterTableView.Rebind();
    }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Layo
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Layo
Top achievements
Rank 1
Share this question
or