如何使用jquery打开带有布局的新页面?我需要在我的控制器中返回strName到我的视图。
我的jquery:
mvcJqGrid.demo.edit = function (id) {
var urlEdit = '@Url.Action("Edit")';
$.ajax({
type:"GET",
url:urlEdit,
data:{strName: $('#customerGrid').jqGrid('getCell',id,'Client00130012')}
});
}编辑:*:*
public ActionResult Edit(string strName)
{
var q = from c in db.CanaClie0012
join w in db.Clientes0013 on c.Client00130012 equals w.Client0013
where c.Client00130012 == strName
select new ClientModel
{
CanaClie0012 = new CanaClie0012()
{
Client00130012 = c.Client00130012,
F1Pais00200012 = c.F1Pais00200012,
F1Cana02530012 = c.F1Cana02530012,
Direcc0012 = c.Direcc0012
},
Clientes0013 = new Clientes0013()
{
Client0013 = w.Client0013,
Nombre0013 = w.Nombre0013,
F1Pais00200013 = w.F1Pais00200013
}
};
return View(q);
}发布于 2013-06-14 13:11:41
您这样做是错误的;如果您想用您的模型打开编辑页面,请尝试下一步。
首先,您需要在网格中构建url链接来使用Model.Id打开这个编辑页面。在jqGrid中,您需要使用列格式化器。之后,你可以点击链接,打开你的编辑页面,比如‘site.com/控制器/编辑/6666’。
colModel: [
{ name: 'ColumnName',
formatter: function (cellvalue, options, rowObject) {
return '<a href="/YourController/Edit/' + cellvalue + '">' + "Edit" + '</a>';
}
},],
这应该能行。
https://stackoverflow.com/questions/17107880
复制相似问题