How to create Select List for Country and States/province in MVC

后端 未结 7 872
一生所求
一生所求 2020-12-05 10:19

Hi I am new to MVC and even asp..

I want to create a form in MVC. With the help of some examples I am able to create TextBoxes, but I now I don\'t understand how to

7条回答
  •  一个人的身影
    2020-12-05 10:51

    Best way to make drop down list:

    grid.Column("PriceType",canSort:true,header: "PriceType",format: @
        @item.PriceTypeDescription
        @Html.DropDownList("PriceType"+(int)item.ShoppingCartID,new SelectList(MvcApplication1.Services.ExigoApiContext.CreateODataContext().PriceTypes.Select(s => new { s.PriceTypeID, s.PriceTypeDescription }).AsEnumerable(),"PriceTypeID", "PriceTypeDescription",Convert.ToInt32(item.PriceTypeId)), new { @class = "PriceType",@style="width:120px;display:none",@selectedvalue="selected"})
            ),
    

提交回复
热议问题