2
嗨我有一个名为data的变量返回以下JSON。Json序列化到剃刀视图模型类的绑定
{"tblMaster":{"intMasterID":14,"intMasterRegionID":1,"intMasterDistrictID":1,"intMasterEduLevelID":2,"txtMasterName":"Kureme","txtMasterPreciseLocation":"bulinga","txtMasterPostalAddress":"bulinga},"txtproperty1":"null"}
和我有一个生成的使用MasterBo Model类的剃须刀页面。 在这MasteBo类别i写的以下代码
public class MasteBo
{
public tblMaster tblMaster { get; set; }
public string tproperty1 { get; set; }
}
剃刀页代码
<div id="tabs-1">
<table>
<tr>
<td>Region:</td>
<td style="width:255px">
@Html.DropDownListFor(model => model.tblMaster.intMasterRegionID, (IEnumerable<SelectListItem>)ViewBag.intMasterRegionID, "--Select--", new { id = "tblMaster_intMasterRegionID",style="width:255px" })
</td><td> @Html.ValidationMessageFor(model => model.tblMaster.intMasterRegionID)</td>
</tr>
<tr>
<td>District:</td>
<td style="width:255px">
@Html.DropDownListFor(model => model.tblMaster.intMasterDistrictID, (IEnumerable<SelectListItem>)ViewBag.intMasterDistrictID, "--Select--")</td>
<td>@Html.ValidationMessageFor(model => model.tblMaster.intMasterDistrictID)</td>
</tr>
<tr>
<td>Education Level</td>
<td style="width:255px">
@Html.DropDownListFor(model => model.tblMaster.intMasterEduLevelID, (IEnumerable<SelectListItem>)ViewBag.MasterEducationalLevels, "--Select--") </td>
<td> @Html.ValidationMessageFor(model => model.tblMaster.intMasterEduLevelID)</td>
</tr>
<tr>
<td>Master Name:</td>
<td style="width:255px">
@Html.DropDownListFor(model => model.tblMaster.intMasterID, (IEnumerable<SelectListItem>)ViewBag.Masters, "--Select--")</td>
<td> @Html.ValidationMessageFor(model => model.tblMaster.txtMasterName)</td>
</tr>
<tr>
<td>Precise Location:</td>
<td>
@Html.EditorFor(model => model.tblMaster.txtMasterPreciseLocation)</td>
<td>@Html.ValidationMessageFor(model => model.tblMaster.txtMasterPreciseLocation)</td>
</tr>
<tr>
<td>Postal Address:</td>
<td>
@Html.TextAreaFor(model => model.tblMaster.txtMasterPostalAddress) </td>
<td>@Html.ValidationMessageFor(model => model.tblMaster.txtMasterPostalAddress)</td>
</tr>
<tr>
</table>
</div>
现在对AJAX请求的compleation如何NEDD结合上述JSON数据到页。
您的视图如何看起来像? – 2013-04-25 04:24:07
我在视图中的剃须刀代码 – user2318139 2013-04-25 05:30:59