ASP.NET MVC dropdownlist

后端 未结 4 1064
后悔当初
后悔当初 2021-02-06 09:35

Can someone point me to an article that shows the dropdownlist being populated from linq to sql (text and value being set).

Thanks Danny

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 10:07

    If you need to add html attributes to your tags this would be a way of doing it. Pass a Model to your View e.i. "return View(someModel)" then in the View:

            
    

    GroupsDropDown is a property in your Model like this:

    public IEnumerable GroupsDropDown { get; set; }

提交回复
热议问题