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

How to visible GridEditCommandColumn some row

2 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nitisak
Top achievements
Rank 1
Nitisak asked on 02 Dec 2013, 11:01 AM
How to visible GridEditCommandColumn some row
ex. visible in rowindex 1 and 3

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Dec 2013, 12:04 PM
Hi Nitisak,

You can hide the GridEditCommandColumn in the ItemDataBound event of the RadGrid.

ASPX:
<telerik:GridEditCommandColumn UniqueName="GridEditCommandColumn1"></telerik:GridEditCommandColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        int index = item.ItemIndex; //Row Index
        if(index==3)  //Your condition
        {
            (item["GridEditCommandColumn1"].Controls[0] as LinkButton).Visible = true;
        }
        else
        {
            (item["GridEditCommandColumn1"].Controls[0] as LinkButton).Visible = false;
        }
    }
}

Thanks,
Princy
0
Nitisak
Top achievements
Rank 1
answered on 03 Dec 2013, 05:12 AM
Hi Princythanks you very very much.
Tags
Grid
Asked by
Nitisak
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Nitisak
Top achievements
Rank 1
Share this question
or