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

[Solved] grid message no records

5 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Francisko
Top achievements
Rank 1
Francisko asked on 08 Nov 2011, 03:45 PM
On my page i use grid, which load data with ajax. But after page loading, for a few moments displayed message "no records" from globalization  file. I try use this code 
$(document).ready(function () {
        $("tr.t-no-data").find("td").text("");
    });
but message dissapers only after second. Is there an easy way to remove message? thanks

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 08 Nov 2011, 04:33 PM
Hello Francisko,

If you want to hide the "no records" message unconditionally, it will be a lot easier and hassle-free to do it with CSS, and you will not experience any lags. Alternatively, use

Html.Telerik().Grid()
       .NoRecordsTemplate("  ")

Greetings,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Francisko
Top achievements
Rank 1
answered on 08 Nov 2011, 05:45 PM
the problem is that if ajax request returned with no data, i want display message about no records 
0
Accepted
Dimo
Telerik team
answered on 09 Nov 2011, 08:54 AM
Hello Francisko,

In this case you can use an empty NoRecordsTemplate or one that says "loading..." or something like that. Subscribe to the OnDataBound event of the Grid, check how many rows you have in the handler ( $(this).data("tGrid").data.length ) and change the NoRecords message to something else.

Regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Francisko
Top achievements
Rank 1
answered on 09 Nov 2011, 01:00 PM
thanks for reply, this is good solution for me.
One more question: can i get strings from gridlocalization.resx file in code?
0
Accepted
Dimo
Telerik team
answered on 09 Nov 2011, 01:09 PM
Hi Francisko,

Yes, you can instantiate a

Telerik.Web.Mvc.UI.GridLocalization(ILocalizationService, CultureInfo)

object in the Controller and use its string properties.

ILocalizationService is an interface defined in Telerik.Web.Mvc / Infrastructure / ILocalizationService.cs

Regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Francisko
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Francisko
Top achievements
Rank 1
Share this question
or