Complex text (ComboBoxFieldSettings)

Hi

Is there a way to display a complex text in combobox result (ComboBoxFieldSettings), like this :


<ComboBoxFieldSettings Text="@("{Code} {County}")" Value="ID"></ComboBoxFieldSettings>

I can create a property in my class for this, but I would have preferred to display it only for a combobox.


5 Replies

SP Sureshkumar P Syncfusion Team March 15, 2022 10:47 AM UTC

Hi Frederic, 

Based on your scenario, we suggest you combine the class variables as per below code to achieve your requirements.  
Find the code example here: 
<SfComboBox TValue="string" TItem="Games" EnablePersistence="true" PopupHeight="230px" Placeholder="Select a game" @bind-Value="@ComboBoxValue" DataSource="@LocalData"> 
                        <ComboBoxFieldSettings Text="Text" Value="ID" /> 
                    </SfComboBox> 
@code { 
    public class Games 
    { 
        public string ID { get; set; } 
 
        public string Name { get; set; } 
 
        public string Code { get; set; } 
 
        public string Text => string.Format("{0} {1}", Code, Name); 
    } 
    private  List<Games> LocalData = new List<Games> { 
 
        new Games() { ID= "Game1", Name= "American Football" , Code="01"}, 
 
        new Games() { ID= "Game2", Name= "Badminton" , Code="02"}, 
 
        new Games() { ID= "Game3", Name= "Basketball" , Code="03"}, 
 
        new Games() { ID= "Game4", Name= "Cricket" , Code="04"}, 
 
        new Games() { ID= "Game5", Name= "Football" , Code="05"}, 
 
        new Games() { ID= "Game6", Name= "Golf" , Code="06"}, 
 
        new Games() { ID= "Game7", Name= "Hockey" , Code="07"}, 
 
        new Games() { ID= "Game8", Name= "Rugby", Code="08"}, 
 
        new Games() { ID= "Game9", Name= "Snooker" , Code="09"}, 
 
        new Games() { ID= "Game10", Name= "Tennis", Code="10"} 
 
    }; 
    public string ComboBoxValue = "Game3"; 
    public string ChangeValue { get; set; } = "Basketball"; 
} 


Regards, 
Sureshkumar P   



HI HilaryKarr July 25, 2022 12:48 PM UTC

 This new feature is the result of a collaboration between the Administration team and the Technical Development team. Visit here to know why are movies based on casinos so popular. Complex text (ComboBoxFieldSettings) allows administrators to define a field that can handle complex text by encapsulating a complex text field into a dialog box that would otherwise appear in the System/Setup screen. Complex text fields will work well with mobile devices as allowed by the Webform standard.



DR Deepak Ramakrishnan Syncfusion Team July 26, 2022 08:20 AM UTC

Hi Hilary,


Thanks for providing detailed explanation . But we are curious to know what complexities or issues you have been faced when using the solution provided in the previous update , So that we can provide modified solutions for it . Also you can use the templated ComboBox component , from that we can customize the items listed in the popup as per our need . Kindly look into the below demo link for your reference.


Demo link : https://blazor.syncfusion.com/demos/combobox/template?theme=fluent


Thanks,

Deepak R.



PD Peter Drier January 13, 2023 02:51 PM UTC

@deepak, that message from Hilary is spam..  Look at the link more closely.




SS Shereen Shajahan Syncfusion Team January 17, 2023 12:21 PM UTC

Peter, thank you for bringing it to our notice.


Loader.
Up arrow icon