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

Accessing auto generated edit and delete columns from ItemDataBound event

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GrZeCh
Top achievements
Rank 2
GrZeCh asked on 03 Jan 2009, 01:09 PM
Hello!

How can I access delete and edit auto generated columns from ItemDataBound event? I want to hide edit/delete if currently bound item not fits some of my conditions.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 05 Jan 2009, 04:45 AM
Hi,

Try the following code snippet in the ItemDataBound event to achieve the desired scenario.

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            LinkButton btnDelete = (LinkButton)item["AutoGeneratedDeleteColumn"].Controls[0]; 
            LinkButton btnEdit = (LinkButton)item["AutoGeneratedEditColumn"].Controls[0]; 
        } 
        
    } 


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