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

Hiden Special Columns when Edit

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
July
Top achievements
Rank 2
July asked on 27 Jun 2012, 02:23 PM
I need hide the first column of the grid when user click on Edit linnk.
Where I can do this?

I attach an image.


this is part of my grid
   <telerik:RadGrid ID="Grid" runat="server" OnNeedDataSource="CommunityGrid_NeedDataSource"
            OnUpdateCommand="CommunityGrid_UpdateCommand" OnInsertCommand="CommunityGrid_InsertCommand"
            AutoGenerateColumns="False" OnItemCommand="CommunityGrid_ItemCommand" OnPreRender="CommunityGrid_PreRender"
            OnItemCreated="CommunityGrid_ItemCreated" OnDeleteCommand="CommunityGrid_DeleteCommand"
            OnItemDataBound="CommunityGrid_ItemDataBound" >
            <MasterTableView DataKeyNames="Id">
                <Columns>
                    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" HeaderStyle-Width="25px"
                        AllowFiltering="false" Resizable="false">
                        <ItemTemplate>
                            <asp:ImageButton ID="EditLink" runat="server" ImageUrl="~/UI/Images/pencil.png">
                            </asp:ImageButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn HeaderStyle-Width="25px" UniqueName="EditCommandColumn"
                        ButtonType="ImageButton" EditImageUrl="../Images/grid_edit.png" Resizable="false">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn UniqueName="btnDelete" ConfirmDialogType="RadWindow" ButtonType="ImageButton"
                        CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="300px" HeaderStyle-Width="25px"
                        Resizable="false" />

I try on item DataBound and ItemCommand and does not work.,

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 28 Jun 2012, 04:38 AM
Hi July,

Try the following code snippet to hide the image in ItemTemplate while editing.

C#:
protected void Grid_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = e.Item as GridDataItem;
        if (e.Item.Edit)
        {
            ImageButton img = (ImageButton)item.FindControl("EditLink");
            img.Visible = false;
        }
    }
}

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