Getting combobox entered text in NoRecordsTemplate

is it possible to get the entered text in the NoRecordsTemplate of Combobox?  The use case is that the noRecordsTemplate should show something like:

<sfbutton>  Create @(entered custom text in combobox text) </sfbutton>

1 Reply 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team October 14, 2020 01:36 PM UTC

Hi HappyCamper, 

Thanks for contacting Syncfusion support. 

As per your requirement we have prepared sample, in which if the typed value is not present in the datasource, by default it shows the NoRecordsTemplate. Here instead we have included the button which shows the typed value as like below screenshot. 

<SfComboBox @ref="ComboObj" TValue="string" @bind-Value="ComboValue" TItem="TItem" DataSource="@DataSource" AllowFiltering="true"> 
    <ComboBoxFieldSettings Text="Name" Value="Name"></ComboBoxFieldSettings> 
    <ComboBoxEvents TValue="string" TItem="TItem" Filtering="onFiltering"></ComboBoxEvents> 
    <ComboBoxTemplates TItem="TItem"> 
        <NoRecordsTemplate> 
            <div> 
                <SfButton CssClass="e-control e-btn" Content="@Content"></SfButton> 
            </div> 
        </NoRecordsTemplate> 
    </ComboBoxTemplates> 
</SfComboBox> 
 
@code { 
 
    public string Content = "Add"; 
    ... 
    public void onFiltering(Syncfusion.Blazor.DropDowns.FilteringEventArgs args) 
    { 
        CustomValue = args.Text; 
        this.Content = args.Text; 
    } 
} 

 
 
Kindly check the above sample meets your requirement. If not please elaborate with more information like pictorial representation to provide you the solution at earliest. 

Regards, 
Ponmani M 


Marked as answer
Loader.
Up arrow icon