Quote:public ActionResult Index() { DDlCombined ddlC = new DDlCombined(); return View(ddlC.GetDistricts()); //return View(registerForm); }
Quote:public class DDlCombined { public int? SelectedDistrictId { get; set; } public int? SelectedTehsilId { get; set; } public IEnumerable<district> GetDistricts() { FarmerDBContext farmerDBContext = new FarmerDBContext(); return farmerDBContext.Districts.ToList(); } public IEnumerable<tehsil> GetTehsil() { FarmerDBContext farmerDBContext = new FarmerDBContext(); return farmerDBContext.Tehsils.ToList(); } }
Quote: @model FarmerRegisterFormAndPrint.Models.DDLCombined @{ ViewBag.Title = "Index"; } <link href="~/Content/StyleSheet.css" rel="stylesheet" /> <script src="~/Scripts/jquery-1.8.2.min.js"></script> <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script> @Html.Partial("_LayoutFarmer") @using (Html.BeginForm("Details", "Details", FormMethod.Post)) { Quote: Html.Label("*Name of District") Html.Partial("_District", Model) Html.Label("*Name of Tehsil") Html.Partial("_Tehsil", Model)
Quote:
Quote:The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[FarmerRegisterFormAndPrint.Models.District]', but this dictionary requires a model item of type 'FarmerRegisterFormAndPrint.Models.DDlCombined'.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)