We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drop Down List Reset to alphabetically (A-Z) Sorting

Thread ID:

Created:

Updated:

Platform:

Replies:

141678 Dec 27,2018 10:40 AM UTC Dec 31,2018 12:42 PM UTC ASP.NET Core - EJ 2 1
loading
Tags: ComboBox
FARIHAH BINTI MOKHTARUDDIN
Asked On December 27, 2018 10:40 AM UTC

Hi all.

I got problem where i need to sort 'Designation' according to seniority and not by alphabetically (A-Z).
I already sort it at stored procedure. (Refer attachment)



But when return view. The designation still sort it according to alphabetically (A-Z). (Refer attachment)







Christopher Issac Sunder K [Syncfusion]
Replied On December 31, 2018 12:42 PM UTC

Hi Farihah, 

Thank you for contacting Syncfusion support. 

We have prepared a sample and validate your reported case. But, we were unable to find out the exact root cause of your reported issue. Based on your shared details, we suspect that the assigned data will be sorted before return to view or DropDownList’s SortOrder may assigned as Ascending.  
So , please ensure the both cases in your end. 
 
Code behind 
<code> 
 
public IActionResult Index() 
        { 
            ViewBag.data = new Vegetables().VegetablesList(); 
 
            //ViewBag.sort = "Ascending"; 
            ViewBag.sort = "None"; 
            return View(); 
        } 
 
</code> 
 
Data: 
<code> 
 
public class Vegetables 
    { 
        public string Vegetable { get; set; } 
        public string Category { get; set; } 
        public string Id { get; set; } 
        public List<Vegetables> VegetablesList() 
        { 
            List<Vegetables> veg = new List<Vegetables>(); 
            veg.Add(new Vegetables { Vegetable = "Yarrow", Category = "Leafy and Salad", Id = "item11" }); 
            veg.Add(new Vegetables { Vegetable = "Wheat grass", Category = "Leafy and Salad", Id = "item10" }); 
            veg.Add(new Vegetables { Vegetable = "Cabbage", Category = "Leafy and Salad", Id = "item1" }); 
            veg.Add(new Vegetables { Vegetable = "Chickpea", Category = "Beans", Id = "item2" }); 
            veg.Add(new Vegetables { Vegetable = "Garlic", Category = "Bulb and Stem", Id = "item3" }); 
            veg.Add(new Vegetables { Vegetable = "Green bean", Category = "Beans", Id = "item4" }); 
            veg.Add(new Vegetables { Vegetable = "Horse gram", Category = "Beans", Id = "item5" }); 
            veg.Add(new Vegetables { Vegetable = "Nopal", Category = "Bulb and Stem", Id = "item6" }); 
            veg.Add(new Vegetables { Vegetable = "Onion", Category = "Bulb and Stem", Id = "item7" }); 
            veg.Add(new Vegetables { Vegetable = "Pumpkins", Category = "Leafy and Salad", Id = "item8" }); 
            veg.Add(new Vegetables { Vegetable = "Spinach", Category = "Leafy and Salad", Id = "item9" }); 
             
             
            return veg; 
        } 
    } 
 
</code> 
 
View: 
<code> 
<ejs-dropdownlist id="games" dataSource="@ViewBag.data" placeholder="Select a game" popupHeight="220px" sortOrder="@ViewBag.sort" > 
    <e-dropdownlist-fields text="Vegetable" value="Id"></e-dropdownlist-fields> 
</ejs-dropdownlist> 
</code> 


Please let us know if you require any further assistance. 

Thanks, 
Christo 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;