gpt4 book ai didi

jquery - 如何在 jQuery 中使用 LinkBut​​ton 的 CommandArgument?

转载 作者:行者123 更新时间:2023-12-01 04:45:08 29 4
gpt4 key购买 nike

我有 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');
}
});

最佳答案

不,你不能在 jQuery 中使用 CommandArgument,因为它存储在页面的 View 状态中。但您可以使用 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>

关于jquery - 如何在 jQuery 中使用 LinkBut​​ton 的 CommandArgument?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30825562/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com