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

How to set the selected item of a DropDownList server-side?

Thread ID:





130252 May 2,2017 03:00 PM UTC May 4,2017 03:48 AM UTC ASP.NET Core 3
Tags: DropDownList
Mark Chidlow
Asked On May 2, 2017 03:00 PM UTC

How do I set the selected item of the DDL server side? Thanks.

Where is this documented please? 

Karthikeyan Viswanathan [Syncfusion]
Replied On May 3, 2017 10:55 AM UTC

Hi Mark,  
Thanks for contacting Syncfusion support. 
You can set a selected item value using model binding in DropdownlistFor control.  Please refer to the code snippet: 
@using (Html.BeginForm()) 
    Html.EJ().DropDownListFor(model => model.bikeValue, (Syncfusion.JavaScript.Models.DropDownListProperties)ViewData["ddl"]).WatermarkText("Select a car").Width("100%").Render(); 
        public IActionResult Index(BikeModel model) 
            DropDownListProperties ddl = new DropDownListProperties(); 
            ddl.DataSource = GetDataSource(); 
            DropDownListFields ddf = new DropDownListFields(); 
            ddf.Text = "text"; 
            ddf.Id = "empid"; 
            ddl.DropDownListFields = ddf; 
            model.bikeValue = "Pulsar"; 
            ViewData["ddl"] = ddl; 
            return View(model); 

Karthikeyan V. 

Mark Chidlow
Replied On May 3, 2017 02:08 PM UTC

Many thanks Karthikeyan - great help!

Karthikeyan Viswanathan [Syncfusion]
Replied On May 4, 2017 03:48 AM UTC

Hi Mark,   
Thanks for the update.  
We are glad the suggestion helped you to achieve your requirement.  
Please let us know if you need further assistance.  
Karthikeyan V. 


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