Radgrid header with NO RECORD FOUND message
Radgrid header with NO RECORD FOUND message
Step 1: Design web form .aspx page
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" PageSize="8" Width="50%" PagerStyle-AlwaysVisible="true"
GridLines="None" AutoGenerateColumns="false"
OnNeedDataSource="RadGrid1_NeedDataSource">
<HeaderStyle HorizontalAlign="Left" />
<MasterTableView DataKeyNames="name" AutoGenerateColumns="false">
<NoRecordsTemplate>No records found.</NoRecordsTemplate>
<Columns>
<telerik:GridBoundColumn HeaderText="Name" DataField="Name" HeaderButtonType="TextButton" />
<telerik:GridBoundColumn HeaderText="Amount" DataField="Amount" HeaderButtonType="TextButton" />
<telerik:GridBoundColumn HeaderText="Phone" DataField="Phone" HeaderButtonType="TextButton" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</div>
Step 2: Logic on .Cs page
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Columns.Add("Amount");
dt.Columns.Add("Phone");
RadGrid1.DataSource = dt;
}
Comments
Post a Comment