How to read the data from a dropdown in ASP.Net MVC 3

后端 未结 3 886
半阙折子戏
半阙折子戏 2021-01-14 23:30

Step 1:

I\'m using a dropdown to display company locations. The list comes from the Location table.

Step 2:

While the user is registering, the drop

3条回答
  •  太阳男子
    2021-01-14 23:52

    It depends how you are getting values of your form if you are passing formcollection then simply you can access its value by this

    public ActionResult MyAction (FormCollection form)
        {
            string value = form["DropDownListName"];
        }
    

    Or you can access it through

    string value = Request.Form["DropDownListName"];
    

提交回复
热议问题