Hi, I want to start with an empty grid where the user can select a commanditem to start adding things to the grid. My problem is that the commanditemdisplay only appears if there are items in the grid.
How do I get the commands to show when the grid is empty?
How do I get the commands to show when the grid is empty?
8 Answers, 1 is accepted
0

Fernandes
Top achievements
Rank 1
answered on 26 Jan 2008, 12:04 AM
Hi Josh,
Are you binding the grid to any datasource? I mean, if the grid is bound to a datasource (DataTable, etc), it will show the "Add new record" command (even if there's no records). Is this your case?
Fernandes
0

Josh
Top achievements
Rank 1
answered on 26 Jan 2008, 12:40 AM
I wasn't, I just tried it and made it so the data source has no records. I do get the command items to show now - is there anyway to not have the 'No records to display' appear in the grid?
0
Accepted

Fernandes
Top achievements
Rank 1
answered on 26 Jan 2008, 01:41 AM
Hi Josh,
Yes there is: you just have to set the NoMasterRecordsText property of the MasterTableView, like this:
Fernandes
Yes there is: you just have to set the NoMasterRecordsText property of the MasterTableView, like this:
<MasterTableView AutoGenerateColumns="True" CommandItemDisplay="Top" CurrentResetPageIndexAction="SetPageIndexToFirst" |
DataKeyNames="EmployeeID" DataSourceID="SqlDataSource1" Dir="LTR" Frame="Border" |
TableLayout="Auto" NoMasterRecordsText=""> |
Fernandes
0

Josh
Top achievements
Rank 1
answered on 26 Jan 2008, 01:44 AM
Thanks, exactly what I was looking for.
0

Michael
Top achievements
Rank 1
answered on 16 Apr 2008, 05:31 PM
Hi.
I have a grid with predefined bound columns. There are no records in data repository therefore there is no record to be shown.
The issue is that I need to display CommandItemTemplate, but unfortunately is not visible...
Here is the script:
As you can see CommandItemTemplate has a single button...
Any idea will be appreciated!!!
Thank you!
Dan
I have a grid with predefined bound columns. There are no records in data repository therefore there is no record to be shown.
The issue is that I need to display CommandItemTemplate, but unfortunately is not visible...
Here is the script:
<Telerik:RadGrid ID="dgMain" runat="server" AllowPaging="True" |
AllowSorting="True" AutoGenerateColumns="False" EnableAJAX="True" EnableAJAXLoadingTemplate="True" |
GridLines="None" GroupingEnabled="False" Height="221px" ShowStatusBar="True" Skin="WebBlue" > |
<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True"> |
<Selecting AllowRowSelect="True"></Selecting> |
<Scrolling UseStaticHeaders="True" AllowScroll="True" ScrollHeight="200px"></Scrolling> |
</ClientSettings> |
<MasterTableView CommandItemDisplay="Top" DataKeyNames="Id" GridLines="None" AllowAutomaticDeletes="true" > |
<ExpandCollapseColumn Visible="False"> |
<HeaderStyle Width="19px"></HeaderStyle> |
<ItemStyle Width="19px"/> |
</ExpandCollapseColumn> |
<RowIndicatorColumn Visible="False"> |
<HeaderStyle Width="20px"></HeaderStyle> |
<ItemStyle Width="20px"/> |
</RowIndicatorColumn> |
<Columns> |
<Telerik:GridTemplateColumn UniqueName="EditColumn"> |
<ItemStyle Width="20px" /> |
<HeaderStyle Width="20px" /> |
<ItemTemplate> |
<asp:ImageButton ID="imgEdit" runat="server" ImageUrl="~/Images/edit.png" /> |
</ItemTemplate> |
</Telerik:GridTemplateColumn> |
............... |
</Columns> |
<CommandItemTemplate> |
<asp:LinkButton ID="btnNew" runat="server"></asp:LinkButton> |
</CommandItemTemplate> |
</MasterTableView> |
<CommandItemStyle HorizontalAlign="Left" VerticalAlign="Top" /> |
<AlternatingItemStyle BackColor="#C0C0FF" /> |
<ExportSettings FileName="GridExport" /> |
</Telerik:RadGrid> |
As you can see CommandItemTemplate has a single button...
Any idea will be appreciated!!!
Thank you!
Dan
0
Hello Dan,
I tested the functionality in question, but the control behaved properly.
Attached to this message, you will find the code, which I used for testing. Let me know if this is the expected behavior.
All the best,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I tested the functionality in question, but the control behaved properly.
Attached to this message, you will find the code, which I used for testing. Let me know if this is the expected behavior.
All the best,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

mary
Top achievements
Rank 1
answered on 15 Aug 2008, 03:59 PM
Hi
This doesn't seem to work with ObjectDataSource or when binding in the NeedDataSource handler. Is there a way to get the standard command item template to display when the grid is empty and you're binding using an ObjectDataSource?
I'm using the latest version of the grid.
Thanks
This doesn't seem to work with ObjectDataSource or when binding in the NeedDataSource handler. Is there a way to get the standard command item template to display when the grid is empty and you're binding using an ObjectDataSource?
I'm using the latest version of the grid.
Thanks
0
Hello mary,
The same behavior is present when the control is bound through NeedDataSource event handler as well.
This is demonstrated in the updated version of the sample, attached to this message.
Take a look at it and let me know how it goes.
Sincerely yours,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
The same behavior is present when the control is bound through NeedDataSource event handler as well.
This is demonstrated in the updated version of the sample, attached to this message.
Take a look at it and let me know how it goes.
Sincerely yours,
Yavor
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.