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

How to disable insert/Cancel Button from Command Item Display

3 Answers 255 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pradeep
Top achievements
Rank 1
Pradeep asked on 15 Oct 2010, 07:30 AM
hi, 

        I need to make insert/cancel button's visibility is false. Is it possible?

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 15 Oct 2010, 09:03 AM
Hello Pradeep,

I suggest that you examine the code snippet below and see if it works for you:
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridCommandItem)
        {
            e.Item.FindControl("InitInsertButton").Parent.Visible = false;
        }
    }

You can also try this way:
ASPX:
...
   <MasterTableView CommandItemDisplay="Top" >
       <CommandItemSettings ShowAddNewRecordButton="false" />
...

Greetings,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Perfect
Top achievements
Rank 1
answered on 05 Jan 2011, 12:47 PM
Hi,

   I want enable this insert/cancel button when I click Add new (link button) in rad grid Insert/Cancel button are visible. I write below code. but I'm unable do that. please help me.
<radG:RadGrid ID="RadGrid" runat="server" Skin="Windows" Width="600px"   OnDeleteCommand="RadGrid_DeleteCommand" OnInsertCommand="RadGrid_InsertCommand"
AllowMultiRowEdit="True" AllowMultiRowSelection="True" AllowSorting="True" GridLines="None">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="Id" EditMode="InPlace"
                CommandItemDisplay="Bottom">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <radG:GridHyperLinkColumn UniqueName="InsertLinkColumn" DataNavigateUrlFields="Id,FileName"
                        Target="_self" DataNavigateUrlFormatString="javascript:submitLink({0}" Text="Link" />
                    <radG:GridHyperLinkColumn UniqueName="InsertImageColumn" DataNavigateUrlFields="Id"
                        Target="_self" DataNavigateUrlFormatString="javascript:submitImg({0})" Text="Image" />
                    <radG:GridTemplateColumn HeaderText="File Attachments" UniqueName="TemplateColumn">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("FileName") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:FileUpload ID="Upload" runat="server" />
                        </EditItemTemplate>
                    </radG:GridTemplateColumn>
                  
        </Columns>
        <CommandItemTemplate>
            <asp:LinkButton ID="btnAdd" Text="Add New" CommandName="InitInsert" Runat="server"></asp:LinkButton>
        </CommandItemTemplate>
        <EditFormSettings>
            <EditColumn FilterImageUrl="" SortAscImageUrl="" SortDescImageUrl="">
            </EditColumn>
        </EditFormSettings>
        <ExpandCollapseColumn FilterImageUrl="" SortAscImageUrl="" SortDescImageUrl="" Visible="False">
            <HeaderStyle Width="19px" />
        </ExpandCollapseColumn>
        <RowIndicatorColumn Visible="False">
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
    </MasterTableView>
</radG:RadGrid>

Thank U in Advance
Mr.Perfect
0
Princy
Top achievements
Rank 2
answered on 05 Jan 2011, 01:20 PM
Hello Jani,

I guess the issue is RadGrid not showing insert/Cancel button when it is in insert mode. You can avoid this by adding an GridEditCommandColumn into column collection and setting its visibility as false from code behind.

Thanks,
Princy.
Tags
Grid
Asked by
Pradeep
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Perfect
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or