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

'Id' Property on DropDownListFor Control

Thread ID:





129413 Mar 16,2017 10:48 AM UTC Mar 17,2017 05:51 AM UTC ASP.NET Core 2
Tags: DropDownList
Sean McGurk
Asked On March 16, 2017 10:48 AM UTC


is it possible for a control to have both an 'id' property and a 'for' property

I have created the following drop-down list control:

@{Html.EJ().DropDownListFor(b => b.BarrelNumber)
                                .DropDownListFields(Df => Df.Text("BarrelNumberNavigation.Number")

and I want to give the drop down list an 'id' property (so that I can cascade to it from another drop-down list).

Is this possible? If so, how would I go about it?



Sean McGurk
Replied On March 16, 2017 11:03 AM UTC

Or... alternatively, how I would include a 'for' property on this control:

                                .DropDownListFields(Df => Df.Text("BarrelNumberNavigation.Number")

Gopi Govindasamy [Syncfusion]
Replied On March 17, 2017 05:51 AM UTC

Hi Sean McGurk,  

Is not possible to use both 'id' and 'for' property. In dropdownlistfor control will generate id and this id used to cascade to another dropdownlist. We have prepared a sample based on your requirement by using cascade to dropdownlistfor. We have attached sample below link.  

   @Html.EJ().DropDownList("groupsList").Datasource((IEnumerable<groups>)ViewBag.datasource).DropDownListFields(f => f.Value("parentId").Text("text")).CascadeTo("auto1").ClientSideEvents(e => e.Change("onChange")).WatermarkText("Select") 
    <div class="col-xs-8 col-sm-4"> 
        <span class="txt">Select Country</span> 
        @Html.EJ().DropDownListFor(model => model.auto1, (Syncfusion.JavaScript.Models.DropDownListProperties)ViewData["ddl"]).Enabled(false) 

Gopi G. 


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