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

Grid / User control edit form

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DW Web Team Member
Top achievements
Rank 2
DW Web Team Member asked on 30 Mar 2011, 03:37 PM
Hi,

In my grid I am using grid / user control edit form, and I have a delete option also like in your demo - http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx. However, when I delete the row that I have edit form expanded the edit form for the next item in the grid expands automatically. I want the edit form to be shown only when the user selects to edit the item and not automatically when the user deletes the item above with the expanded edit form. How can I do it?

Thank you

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Mar 2011, 06:31 AM
Hello,

I guess you have added the following code in PreRender event (which will show the first item in edit mode). Remove that code and see whether it works now.

C#:
protected void RadGrid1_PreRender(object sender, System.EventArgs e)
        {
                this.RadGrid1.MasterTableView.Items[1].Edit = true;
                this.RadGrid1.MasterTableView.Rebind();
         }

Thanks,
Princy.
0
Tatiana
Top achievements
Rank 2
answered on 31 Mar 2011, 01:23 PM
Thank you for the suggestion. It would be a good solution. However, I do not have these lines of code. Probably I did not describe the situation clear enough. And I apologize for that. The scenario is like that. The user wanted to edit an item and after reviewing the information decided to delete it without canceling the edit mode. After the delete, the next item in the grid automatically appears in edit mode. I want it to stay as it was before deleting - not in the edit mode. And I noticed that it happens with user control.
0
Tatiana
Top achievements
Rank 2
answered on 31 Mar 2011, 04:17 PM
The solution is turned out to be pretty simple. All what I needed to do is to clear EditIndexes of the grid on delete:

    grdSurveys.EditIndexes.Clear();

Tags
Grid
Asked by
DW Web Team Member
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Tatiana
Top achievements
Rank 2
Share this question
or