MVC 下拉框

            <div class="form-group">
                @Html.LabelFor(model => model.Lesson_id, "Lesson_id", htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.DropDownList("Lesson_id", null, htmlAttributes: new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Lesson_id, "", new { @class = "text-danger" })
                </div>
            </div>

  

        public ActionResult Create_Course()
        {
            ViewBag.Coupon_id = new SelectList(db.kywkt_Coupon, "Id", "Code");
            ViewBag.Lesson_id = new SelectList(db.kywkt_Lesson, "LID", "Title");
            return View();
        }

MVC5 DropDownList使用 注意位置

@Html.DropDownList("Lesson_id", 


原文地址:https://www.cnblogs.com/qq22144770/p/5255414.html