Duplicated
Last Updated: 19 Sep 2021 14:20 by ADMIN
Vishnu
Created on: 09 Nov 2020 17:31
Category: UI for Blazor
Type: Feature Request
3
No Data Template in the DropDownList

I would like to be able to override the No Data message in DropDownList component when there are no elements in the Data.

 

--

ADMIN EDIT

Until this feature is implemented, here is a workaround.

If you already have localization in your project, just set "DropDownList_NoData" key to an empty string in your resources.

If you don't have localization, here are the steps you should do (shortened version of the documentation):

1. Create a class for your localizer: 

public class SampleResxLocalizer : ITelerikStringLocalizer
{
    public string this[string name]
    {
        get
        {
            return GetStringFromResource(name);
        }
    }

    public string GetStringFromResource(string key)
    {
        // this will override only DropDownList_NoData message and it will return other messages as they are
        if (key == nameof(Messages.DropDownList_NoData))
        {
            return string.Empty;
        }

            return Messages.ResourceManager.GetString(key, Messages.Culture); ;
        }
}

 

2. Override the existing Localizer. This step should be done when configuring your services after calling "AddTelerikBlazor()":

 

builder.Services.AddSingleton(typeof(ITelerikStringLocalizer), typeof(SampleResxLocalizer));


--

Duplicated
This item is a duplicate of an already existing item. You can find the original item here:
2 comments
ADMIN
Marin Bratanov
Posted on: 27 Nov 2020 13:47

Hi Vishnu,

This indicates that the localization service is  not implemented correctly and/or the code and namespaces don't match. The "Messages" class matches the name of the .resx files, so it coul be something like "TelerikMessages" or something else in your case. You can review the following article for more details on how to implement localization for the Telerik components: https://docs.telerik.com/blazor-ui/globalization/localization

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Vishnu
Posted on: 21 Nov 2020 04:57

Thank you

I am getting error for below code