作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 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 中使用 LinkButton 的 CommandArgument?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30825562/
我是一名优秀的程序员,十分优秀!