I have a RadGrid where I expect the "Add New" button to appear on the top of the grid even when there are no records present. In fact, it only appears when there are 1 or more records present. Furthermore, the "No records to display" text is not being shown when the grid is empty. Here is my code:
Thanks in advance,
Richard
| <telerik:RadGrid |
| ID="RadGrid" |
| Width="820" |
| runat="server" |
| AutoGenerateColumns="False" |
| OnNeedDataSource="RadGrid_NeedDataSource" |
| OnDeleteCommand="RadGrid_Command" |
| OnInsertCommand="RadGrid_Command" |
| OnUpdateCommand="RadGrid_Command" |
| GridLines="None" |
| ShowFooter="True" |
| GroupingEnabled="False" |
| Skin="Telerik"> |
| <MasterTableView |
| DataKeyNames="CategoryID" |
| GridLines="None" |
| CommandItemDisplay="Top" |
| NoMasterRecordsText="No Categories have been added."> |
| <CommandItemSettings |
| AddNewRecordText="Add New Category" |
| RefreshText="Refresh Category List" /> |
| <Columns> |
| <telerik:GridButtonColumn |
| CommandName="Delete" |
| Text="Delete" |
| UniqueName="Delete" |
| ButtonType="ImageButton"> |
| </telerik:GridButtonColumn> |
| <telerik:GridBoundColumn |
| DataField="CategoryID" |
| HeaderText="CategoryID" |
| UniqueName="CategoryID" |
| ReadOnly="True"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn |
| DataField="CategoryTitle" |
| HeaderText="CategoryTitle" |
| UniqueName="CategoryTitle"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn |
| DataField="CategoryDescription" |
| HeaderText="CategoryDescription" |
| UniqueName="CategoryDescription"> |
| </telerik:GridBoundColumn> |
| <telerik:GridEditCommandColumn |
| ButtonType="ImageButton"> |
| </telerik:GridEditCommandColumn> |
| </Columns> |
| <EditFormSettings |
| ColumnNumber="2" |
| CaptionFormatString="Edit details for category with ID {0}" |
| CaptionDataField="CategoryID"> |
| <FormTableItemStyle |
| Wrap="False"> |
| </FormTableItemStyle> |
| <FormCaptionStyle |
| CssClass="EditFormHeader"> |
| </FormCaptionStyle> |
| <FormMainTableStyle |
| CellSpacing="0" |
| CellPadding="3" |
| Width="100%" /> |
| <FormTableStyle |
| GridLines="Horizontal" |
| CellSpacing="0" |
| CellPadding="2" |
| CssClass="module" |
| Height="110px" |
| Width="100%" /> |
| <FormTableAlternatingItemStyle |
| Wrap="False"> |
| </FormTableAlternatingItemStyle> |
| <FormStyle |
| Width="100%" |
| BackColor="#EEF2EA"> |
| </FormStyle> |
| <EditColumn |
| UpdateText="Update record" |
| UniqueName="EditCommandColumn1" |
| CancelText="Cancel edit"> |
| </EditColumn> |
| <FormTableButtonRowStyle |
| HorizontalAlign="Right" |
| CssClass="EditFormButtonRow"> |
| </FormTableButtonRowStyle> |
| </EditFormSettings> |
| <ExpandCollapseColumn> |
| <HeaderStyle |
| Width="19px"> |
| </HeaderStyle> |
| </ExpandCollapseColumn> |
| <RowIndicatorColumn> |
| <HeaderStyle |
| Width="20px" /> |
| </RowIndicatorColumn> |
| </MasterTableView> |
| <FilterMenu |
| EnableTheming="True"> |
| <CollapseAnimation |
| Duration="200" |
| Type="OutQuint" /> |
| </FilterMenu> |
| </telerik:RadGrid> |
And some of code behind:
| protected void RadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| this.categories = new Categories(); |
| this.dataSet = this.categories.Select(); |
| this.RadGrid.DataSource = this.dataSet; |
| } |
Why is it not possible to add a new record when the dataset is empty (null) and why is the no records message not showing? I have insert/update/delete with ReBind working no worries apart from this.
Thanks in advance,
Richard
