Two tables are there
1. Status_Master
2. Role Master
a. Status_Id(Identity,Primary key) a. Role_Id(Identity,Primary key)
b. Status_Desc. b. Role_Desc
c. Remarks c. Status (wants for Dropdown list)
Here Model is [Status_Master_Model] Here Model is [Role_Master_Model]
Question is in [Role_Master_Model] view i have to us Dropdown for column c i.e (Status) an d bind the value from [Status_Master_Model] for column b i.e (Status_Desc.)
Help me with codes....as i am doing in [Role_Master_Model]..[@Html.TextBoxFor(m => m.Status) ]..as stated in red one..errror is coming as [Role_Master_Model] does not contain its defination

Kunal Gupta147 reputationPosted Jul 14, 2016, 11:29 PM EDT
Rajeev PunhaniRank #551 · 4.4K reputationPosted Jul 10, 2016, 9:09 PM EDT
Hi Kunal,
Please see the below link.
Kunal Gupta147 reputationPosted Jul 10, 2016, 9:23 PM EDT
kalu singh raoRank #884 · 2.4K reputationPosted Jul 10, 2016, 9:54 PM EDT
Rajeev PunhaniRank #551 · 4.4K reputationPosted Jul 10, 2016, 9:59 PM EDT
Hi Kunal,
Please post your Modeland ViewCode.I think you are missing property from Status_Master_Model and Role_Master_Model.
Kunal Gupta147 reputationPosted Jul 10, 2016, 10:47 PM EDT
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace vijay_dotnet.Models
{
public class Role_Master_Model
{
public int Role_Id { get; set; }
public string Role_Description { get; set; }
public string Status { get; set; }
public IEnumerable<SelectListItem> Status_Description { get; set; }
}
}
Kunal Gupta147 reputationPosted Jul 10, 2016, 10:47 PM EDT
@{
ViewBag.Title = "Role";
}
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<table width="100%" border="1" cellspacing="2">
<tr>
<td colspan="2" ><b>Role Master</b></td>
</tr>
<tr>
<td align="right">Role Description :</td>
<td >@Html.TextBoxFor(m => m.Role_Description)</td>
</tr>
<div class="row">
<div class="col-md-3">
@Html.DisplayName("Status")
</div>
<div class="col-md-3">
@Html.DropDownListFor(model => model.Role_Id, new SelectList(Model.Status_Description, "Value", "Text"), new { @class = "form-control" })
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
</div>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Save" />
</td>
</tr>
</table>
}
<div>
@Html.ActionLink("Back to List", "List")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
Kunal Gupta147 reputationPosted Jul 10, 2016, 10:49 PM EDT
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using vijay_dotnet.Models;
namespace vijay_dotnet.Controllers
{
public class RoleController : Controller
{
//
// GET: /Role/
public ActionResult Role()
{
return View();
}
}
}
Kunal Gupta147 reputationPosted Jul 10, 2016, 10:49 PM EDT
Kunal Gupta147 reputationPosted Jul 11, 2016, 2:02 AM EDT
Kunal Gupta147 reputationPosted Jul 12, 2016, 9:54 PM EDT
Rajeev PunhaniRank #551 · 4.4K reputationPosted Jul 13, 2016, 2:54 AM EDT
If the above solution is helpful then,accept the answer.
Kunal Gupta147 reputationPosted Jul 14, 2016, 10:32 PM EDT
Kunal Gupta147 reputationPosted Jul 14, 2016, 11:28 PM EDT
Kunal Gupta147 reputationPosted Jul 15, 2016, 1:06 AM EDT
Soumalya DasRank #2,515 · 558 reputationPosted Aug 7, 2016, 8:00 AM EDT