3 Answers, 1 is accepted
0
Hello Pradeep,
I suggest that you examine the code snippet below and see if it works for you:
C#:
You can also try this way:
ASPX:
Greetings,
Pavlina
the Telerik team
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
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.
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.