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

Radgrid inline custom error messages

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alia
Top achievements
Rank 1
Alia asked on 20 Mar 2015, 04:48 PM
 Hello,
I want to check how we can show the custom error messages inside the grid. so in this case, if returned rows are more than 100, we need to show a message for user to narrow down the search.

I enabled EnabledNoRecordsTemplate for the grid if no records are returned but not sure how we can another message inside the grid based on some condition.

Your help will be highly appreciated.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 25 Mar 2015, 07:24 AM
Hello Alia,

Depending on your custom condition you could change the NoMasterRecordsText property within the OnNeedDataSource event for example, when you could prevent the loading of the data in the first place:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    ...
    if (rowCount > 100)
    {
        RadGrid1.MasterTableView.NoMasterRecordsText = "Please narrow down the search";
        RadGrid1.DataSource = new List<string>();
    }
}

However, please note that the above will be suitable only for scenarios where you are filtering the data through some separate control and not from RadGrid.

On a side note, you could always enable the Paging functionality of the grid and display 100 rows on each page.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Alia
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or