我有5个链接按钮。我希望将他们的命令参数发送到web方法中,以加载页面滚动。
$.ajax({
type: "POST",
url: "Default.aspx/GetCustomers",
data: '{pageIndex:'+pageIndex+'}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert('Hell 1');
},
error: function (response) {
alert('Hell 2');
}
});发布于 2015-06-14 03:54:33
不,不能在CommandArgument中使用jQuery,因为它存储在页面的视图状态中。但是您可以使用data-...属性代替。
<asp:LinkButton ID="btnSave" runat="server" Text="Save" data-id="<%# DataBinder.Eval(Container.DataItem, "ID") %>" />
<script>
var id = $('#btnSave').data('id');
// use id
</script>https://stackoverflow.com/questions/30825562
复制相似问题