Unplanned
Last Updated: 21 Nov 2020 04:57 by Vishnu
Vishnu
Created on: 09 Nov 2020 17:31
Category: UI for Blazor
Type: Feature Request
1
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));


--

1 comment
Vishnu
Posted on: 21 Nov 2020 04:57

Thank you

I am getting error for below code