编辑MVC网格内的按钮 [英] Edit button inside a MVC grid
本文介绍了编辑MVC网格内的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MVC网格中,我有一个编辑按钮来编辑细节。但是当我点击按钮时我无法调用该方法。
< script >
函数updatecall(id){
alert(id);
$ .ajax({
url:'@ Url.Action(edit,PhoneBook)',
cache:false,
数据:{
'id':id
},
成功:函数(结果){},
错误:函数(结果){}
})
}
< / script >
< a href = @ Url.Action( 编辑, PhoneBook, new { id = d.MObileNUmber }) title = < span class =code-keyword>编辑 > 编辑< / a >
< a href = #删除 id = Del ete_pop onclick = 删除(@ d.MObileNUmber) > 删除 < / a >
< / b > );
解决方案
.ajax({
url:'@ Url.Action(edit,PhoneBook)',
cache:false,
data:{
'id':id
},
success:function(result){},
error:function(result){ }
})
}
< / script >
< a < span class =code-attribute> href = @ Url.Action( edit, PhoneBook, new { id < span class =code-attribute> = d.MObileNUmber }) title = 编辑 &g t; 编辑< / a > ;
< a href = #Delete id = Delete_pop onclick = 删除(@ d.MObileNUmber) > 删除< / a >
< span class =code-keyword>< / b > );
试试这个,
< a href = / ControllerName / MethodName?参数 > 编辑< / a > 跨度>
In a MVC grid i have an edit button to edit the details.But when i am clicking on the button im unable to call the method.
<script>
function updatecall(id) {
alert(id);
$.ajax({
url: '@Url.Action("edit", "PhoneBook")',
cache: false,
data: {
'id': id
},
success: function (result) { },
error: function (result) { }
})
}
</script>
<a href=@Url.Action("edit", "PhoneBook", new { id = d.MObileNUmber }) title="Edit" >Edit</a>
<a href="#Delete" id="Delete_pop" onclick="Delete(@d.MObileNUmber)">Delete</a>
</b>);
解决方案
.ajax({ url: '@Url.Action("edit", "PhoneBook")', cache: false, data: { 'id': id }, success: function (result) { }, error: function (result) { } }) } </script>
<a href=@Url.Action("edit", "PhoneBook", new { id = d.MObileNUmber }) title="Edit" >Edit</a> <a href="#Delete" id="Delete_pop" onclick="Delete(@d.MObileNUmber)">Delete</a> </b>);
try this, <a href="/ControllerName/MethodName?Parameters" >Edit</a>
这篇关于编辑MVC网格内的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文