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

[Solved] In Edit mode disable all other rows edit and delete buttons of grid

1 Answer 332 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Binod
Top achievements
Rank 1
Binod asked on 23 Jun 2009, 11:03 AM

Hi Telerik..

In Grid i am doing Edit/Insert in InPlace and EditForms mode. I am able to disable the edit and delete buttons of currently edited row of grid..
But my requirement is that if any one row of grid is in edit/insert mode then all the Edit/Delete buttons of other row in grid should be disabled. i mean if i am editing a row then other's row edit/delete button should not work.
Please help me how to achieve this.
Thankyou in advance

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Jun 2009, 12:07 PM
Hello Binod,

You can try out the following code to hide the EditButtons and DeleteButtons for all the rows if any one row is in edit mode:
aspx:
 <telerik:GridEditCommandColumn UniqueName="EditColumn"
 </telerik:GridEditCommandColumn> 
 <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete"
 </telerik:GridButtonColumn>               
  

c#:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.Items) 
        { 
            if (RadGrid1.EditIndexes.Count > 0) 
            { 
                ((LinkButton)item["EditColumn"].Controls[0]).Visible = false
                ((LinkButton)item["DeleteColumn"].Controls[0]).Visible = false
            } 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Binod
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or