后台方庄List razor 循环

 后台:

  //1.查询所有年卡类型
                StringBuilder sqlStr = new StringBuilder();
                sqlStr.Append(string.Format("  select  Id,TypeName  from tb_yearcard_cardtype where MerchantCode='{0}' ",this.Base_Code));
                DataTable dt = Shove.Database.MySQL.Select(sqlStr.ToString());
                List<YearcardCardType> y_List = new List<YearcardCardType>();


                ViewBag.YearCarEditType = 1;//操作类别
                ViewBag.yearCardCardType = y_List;//列表

 

 

 

 

 

 

 

视图:

 

头部引用     @using EquipmentPay.Areas.Web.Models;

        @foreach (YearcardCardType data in @ViewBag.yearCardCardType as List<YearcardCardType>)
                                    {    
                                        <option value='@data.Id'>@data.TypeName</option>
                                    }

 

posted @ 2017-07-19 18:49  越过那个限制  阅读(146)  评论(0编辑  收藏  举报