Creating an object from a DropDownList

2 posts, 0 answers
  1. Jared
    Jared avatar
    1 posts
    Member since:
    Oct 2014

    Posted 04 May 2015 Link to this post

    I have a form with a drop down list inside of it.  When the form is posted I want the data in the drop down list to be written into Class B, which is an attribute of Class A on the MVC side.

    Can this be done?  Is there any way to format or pull the data from the Drop down list directly into Class B, which is inside of Class A?  Is there some way to map the input from the drop down list to this element?

     

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 06 May 2015 Link to this post

    Hello Jared,

    You can achieve this either by using a custom model binder on the server side, or by subscribing to the form's submit event and modifying the values before posting them.

    Regards,
    Alexander Popov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top