@(Html.Kendo().DropDownListFor(m => m.PackageId)
.OptionLabel("Select a Package...")
.Name("PackageId")
.DataValueField("PackageId")
.DataTextField("PackageName")
.BindTo(Model.ListOfTenantPackages)
.Template("<div class=\"k-state-default\">#:data.PackageName#</div><div class=\"k-state-default\">#:data.PackageValue #</div><div class=\"k-state-default\">#:data.PackageDescription #</div>")
.HtmlAttributes(new { @class="drop-down col-lg-6 col-md-6", onchange = "update_preview()"}))
This is the code that I have for my Kendo dropdown list. On the post back, I'm getting the package name as the value of the selected item instead of the package ID. Why?
Try removing the
.Name("PackageId")
line.
You don't need to specify the Name for the DropDownListFor<> to work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.