I have a RadGrid with CommandItemTemplate having Link button with CommandName ="Add". This button generates the ItemCommand event if the grid is showing records. When the grid is empty"No records to display", the ItemCommand is not firing.
<telerik:RadGrid ID="rdgImpactTimeList" runat="server" AllowFilteringByColumn="false"
AllowPaging="True" AllowCustomPaging="true" BackColor="White" AllowSorting="True"
AutoGenerateColumns="true" Skin="MyCustomSkin" EnableEmbeddedSkins="false" ShowGroupPanel="True"
AllowMultiRowSelection="true" OnNeedDataSource="rdgImpactTimeList_NeedDataSource"
OnDeleteCommand="rdgImpactTimeList_DeleteCommand"
OnItemCommand="rdgImpactTimeList_ItemCommand"
OnItemCreated="rdgImpactTimeList_ItemCreated"
OnLoad="rdgImpactTimeList_Load"
Width="99.8%" Height="500px" PageSize="10" EnableHeaderContextMenu="true">
<PagerStyle Mode="NextPrevAndNumeric" PrevPageToolTip="Previous" NextPagesToolTip="Next"
AlwaysVisible="true" />
<GroupingSettings CaseSensitive="false" ShowUnGroupButton="true" UnGroupButtonTooltip="Click here to ungroup" />
<MasterTableView Name="ImpactTimeList" ClientDataKeyNames="ImpactTimeID" DataKeyNames="ImpactTimeID" CommandItemDisplay="Top" AllowMultiColumnSorting="true"
Width="100%" ItemStyle-HorizontalAlign="Left" AlternatingItemStyle-HorizontalAlign="Left">
<FilterItemStyle HorizontalAlign="Left" />
<ItemStyle HorizontalAlign="Left" Height="10px"></ItemStyle>
<AlternatingItemStyle HorizontalAlign="Left"></AlternatingItemStyle>
<Columns>
<telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn" ItemStyle-HorizontalAlign="Left">
<HeaderStyle Width="40px" />
</telerik:GridClientSelectColumn>
<telerik:GridEditCommandColumn EditImageUrl="~/images/telerik/Edit.gif" ButtonType="ImageButton"
UniqueName="EditCommandColumn" ItemStyle-HorizontalAlign="Center">
<HeaderStyle Width="40px" />
</telerik:GridEditCommandColumn>
</Columns>
<CommandItemTemplate>
<div style="padding: 5px 5px; text-align: left;">
<span style="float: left;"><span id="spanAdd" runat="server" style="margin-left: 5px;
margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="btnInitInsert" runat="server"
CommandName="Add">
<img id="imgAdd" runat="server" style="border: 0px; vertical-align: top;" alt=""
src="~/images/telerik/AddRecord.png" />
Add new
</asp:LinkButton>
</span><span style="margin-left: 5px; margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="ToggleFiltering" runat="server" CausesValidation="false" CommandName="ToggleFiltering">
<img id="imgToggle" runat="server" style="border: 0px; vertical-align: top;" alt=""
src="~/images/telerik/search.png" />
Filter</asp:LinkButton>
</span><span style="margin-left: 5px; margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="RemoveFilter" runat="server" CausesValidation="false" CommandName="RemoveFilter">
<img id="img1" runat="server" style="border: 0px; vertical-align: top;" alt="" src="~/images/telerik/filterdelete.png" />
Remove Filter</asp:LinkButton>
</span><span style="margin-left: 5px; margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="btnRefresh" runat="server" CommandName="RebindGrid" CausesValidation="false">
<img id="imgRefresh" runat="server" style="border: 0px; vertical-align: top;" alt=""
src="~/images/telerik/Refresh.png" />
Refresh</asp:LinkButton>
</span></span>
</div>
</CommandItemTemplate>
<RowIndicatorColumn Visible="True">
</RowIndicatorColumn>
</MasterTableView>
<ClientSettings ColumnsReorderMethod="Reorder" AllowColumnsReorder="True" AllowKeyboardNavigation="true"
AllowAutoScrollOnDragDrop="true" ReorderColumnsOnClient="true" AllowDragToGroup="True"
EnableRowHoverStyle="true">
<Selecting AllowRowSelect="True" />
<ClientMessages DragToGroupOrReorder="Select All" />
<Selecting AllowRowSelect="True" />
<Resizing AllowColumnResize="true" EnableRealTimeResize="true" AllowRowResize="true"
ResizeGridOnColumnResize="true" ShowRowIndicatorColumn="false" />
<Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true">
</Scrolling>
<ClientEvents OnRowCreated="rdgImpactTimeList_RowCreated" OnRowSelected="rdgImpactTimeList_RowSelected"
OnRowDeselected="rdgImpactTimeList_RowDeselected" />
</ClientSettings>
<FilterMenu EnableEmbeddedSkins="false">
</FilterMenu>
</telerik:RadGrid>
Please help me get the add working.
<telerik:RadGrid ID="rdgImpactTimeList" runat="server" AllowFilteringByColumn="false"
AllowPaging="True" AllowCustomPaging="true" BackColor="White" AllowSorting="True"
AutoGenerateColumns="true" Skin="MyCustomSkin" EnableEmbeddedSkins="false" ShowGroupPanel="True"
AllowMultiRowSelection="true" OnNeedDataSource="rdgImpactTimeList_NeedDataSource"
OnDeleteCommand="rdgImpactTimeList_DeleteCommand"
OnItemCommand="rdgImpactTimeList_ItemCommand"
OnItemCreated="rdgImpactTimeList_ItemCreated"
OnLoad="rdgImpactTimeList_Load"
Width="99.8%" Height="500px" PageSize="10" EnableHeaderContextMenu="true">
<PagerStyle Mode="NextPrevAndNumeric" PrevPageToolTip="Previous" NextPagesToolTip="Next"
AlwaysVisible="true" />
<GroupingSettings CaseSensitive="false" ShowUnGroupButton="true" UnGroupButtonTooltip="Click here to ungroup" />
<MasterTableView Name="ImpactTimeList" ClientDataKeyNames="ImpactTimeID" DataKeyNames="ImpactTimeID" CommandItemDisplay="Top" AllowMultiColumnSorting="true"
Width="100%" ItemStyle-HorizontalAlign="Left" AlternatingItemStyle-HorizontalAlign="Left">
<FilterItemStyle HorizontalAlign="Left" />
<ItemStyle HorizontalAlign="Left" Height="10px"></ItemStyle>
<AlternatingItemStyle HorizontalAlign="Left"></AlternatingItemStyle>
<Columns>
<telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn" ItemStyle-HorizontalAlign="Left">
<HeaderStyle Width="40px" />
</telerik:GridClientSelectColumn>
<telerik:GridEditCommandColumn EditImageUrl="~/images/telerik/Edit.gif" ButtonType="ImageButton"
UniqueName="EditCommandColumn" ItemStyle-HorizontalAlign="Center">
<HeaderStyle Width="40px" />
</telerik:GridEditCommandColumn>
</Columns>
<CommandItemTemplate>
<div style="padding: 5px 5px; text-align: left;">
<span style="float: left;"><span id="spanAdd" runat="server" style="margin-left: 5px;
margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="btnInitInsert" runat="server"
CommandName="Add">
<img id="imgAdd" runat="server" style="border: 0px; vertical-align: top;" alt=""
src="~/images/telerik/AddRecord.png" />
Add new
</asp:LinkButton>
</span><span style="margin-left: 5px; margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="ToggleFiltering" runat="server" CausesValidation="false" CommandName="ToggleFiltering">
<img id="imgToggle" runat="server" style="border: 0px; vertical-align: top;" alt=""
src="~/images/telerik/search.png" />
Filter</asp:LinkButton>
</span><span style="margin-left: 5px; margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="RemoveFilter" runat="server" CausesValidation="false" CommandName="RemoveFilter">
<img id="img1" runat="server" style="border: 0px; vertical-align: top;" alt="" src="~/images/telerik/filterdelete.png" />
Remove Filter</asp:LinkButton>
</span><span style="margin-left: 5px; margin-top: 5px; margin-bottom: 5px; margin-right: 10px;">
<asp:LinkButton ID="btnRefresh" runat="server" CommandName="RebindGrid" CausesValidation="false">
<img id="imgRefresh" runat="server" style="border: 0px; vertical-align: top;" alt=""
src="~/images/telerik/Refresh.png" />
Refresh</asp:LinkButton>
</span></span>
</div>
</CommandItemTemplate>
<RowIndicatorColumn Visible="True">
</RowIndicatorColumn>
</MasterTableView>
<ClientSettings ColumnsReorderMethod="Reorder" AllowColumnsReorder="True" AllowKeyboardNavigation="true"
AllowAutoScrollOnDragDrop="true" ReorderColumnsOnClient="true" AllowDragToGroup="True"
EnableRowHoverStyle="true">
<Selecting AllowRowSelect="True" />
<ClientMessages DragToGroupOrReorder="Select All" />
<Selecting AllowRowSelect="True" />
<Resizing AllowColumnResize="true" EnableRealTimeResize="true" AllowRowResize="true"
ResizeGridOnColumnResize="true" ShowRowIndicatorColumn="false" />
<Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true">
</Scrolling>
<ClientEvents OnRowCreated="rdgImpactTimeList_RowCreated" OnRowSelected="rdgImpactTimeList_RowSelected"
OnRowDeselected="rdgImpactTimeList_RowDeselected" />
</ClientSettings>
<FilterMenu EnableEmbeddedSkins="false">
</FilterMenu>
</telerik:RadGrid>
Please help me get the add working.