@using (Html.BeginForm())
{
<table>
<tr>
<td>门牌号:</td>
<td>@Html.TextBoxFor(T => T.Door)</td>
</tr>
<tr>
<td>类别:</td>
<td>@Html.DropDownList("TypeID", ViewBag.list as SelectList,"全部")</td>
</tr>
<tr>
<td>费用:</td>
<td>@Html.TextBoxFor(T => T.MoneyInfo)</td>
</tr>
<tr>
<td>收费人:</td>
<td>@Html.TextBoxFor(T => T.GetMoneyman)</td>
</tr>
<tr>
<td>时间:</td>
<td>@Html.TextBoxFor(T => T.TimeInof)</td>
</tr>
<tr>
<td>@Html.HiddenFor(T=>T.ID)</td>
<td><input type="submit" value="提交" class="btn-success" /></td>
</tr>
</table>
}
<script>
$(document).ready(function () {
debugger;
var id = location.search.split("=")[1];
$.ajax({
url: "http://localhost:9556/apiD/product/Getone",
data:{"id":id},
type: "Get",
success: function (data) {
alert(data);
var a = data.ID;
var f = data.Door;
var b = data.TypeID;
var c = data.MoneyInfo;
var d = data.GetMoneyman;
var e = data.TimeInof;
$("#ID").val(a);
$("#Door").val(f);
$("#TypeID").val(b);
$("#MoneyInfo").val(c);
$("#GetMoneyman").val(d);
$("#TimeInof").val(e)
}
})
})
原文:http://www.cnblogs.com/NETSBW/p/7875107.html