This is a migrated thread and some comments may be shown as answers.

Customize no record template

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dawson
Top achievements
Rank 1
Dawson asked on 27 Sep 2013, 09:55 AM

Hi,
How to customize the text of no record template of a radgrid.

Thanks,
Dawson

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 27 Sep 2013, 09:59 AM
Hi Dawson,

Please try the following sample code snippet.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" OnItemCreated="RadGrid1_ItemCreated">
    <MasterTableView ShowHeadersWhenNoRecords="true">
        <NoRecordsTemplate>           
            <asp:Label runat="server" ID="lbl" />
        </NoRecordsTemplate>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
   {
     if (e.Item is GridNoRecordsItem)
     {
         GridNoRecordsItem norecordItem = (GridNoRecordsItem)e.Item;
         Label l = (Label)norecordItem.FindControl("lbl");
         l.Text = "Your Text";
      }      
   }

Thanks,
Princy
Tags
Grid
Asked by
Dawson
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or