我正在使用AJAX搜索产品,但是我对具有click
功能的产品的代码有所设置,但ShopAjaxSearch.aspx
内的点击功能在结果返回后没有触发。
ShopAjax.aspx:
<div id="demo-2">
<input type="search" placeholder="Search" onchange="this.value='';" id="txtBrand">
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#txtBrand').keyup(function() {
var param = {
"str": $(this).val()
};
$.ajax({
url: "ShopAjaxSearch.aspx",
data: param,
success: function(data) {
$('#result').html(data);
},
error: function() {
alert('Error');
}
});
});
});
</script>
<div id="result">
</div>
ShopAjaxSearch:
<div class="pagging">
<asp:DataList ID="dlPaging" runat="server" RepeatDirection="Horizontal" OnItemCommand="dlPaging_ItemCommand" OnItemDataBound="dlPaging_ItemDataBound" CssClass="pagenumON">
<ItemTemplate>
<asp:LinkButton ID="lnkbtnPaging" runat="server" CommandArgument='<%#Eval("PageIndex") %>' CommandName="Paging" Text='<%# Eval("PageText") %>' CssClass="pagenum"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
<asp:Label id="lblPageInfo" runat="server" ForeColor="Red"> </asp:Label>
<asp:LinkButton ID="lbtnPrevious" runat="server" CausesValidation="false" OnClick="lbtnPrevious_Click" CssClass="button prev">Previous</asp:LinkButton>
<asp:LinkButton ID="lbtnNext" runat="server" CausesValidation="false" OnClick="lbtnNext_Click" CssClass="button next">Next</asp:LinkButton>
<asp:LinkButton ID="lbtnFirst" runat="server" CausesValidation="false" OnClick="lbtnFirst_Click" CssClass="button prev">First</asp:LinkButton>
<asp:LinkButton ID="lbtnLast" runat="server" CausesValidation="false" OnClick="lbtnLast_Click" CssClass="button next">Last</asp:LinkButton>
</div>
链接按钮Next,Previous,First,Last
未在 ShopAjax.aspx
请帮助谢谢!!
答案 0 :(得分:0)
搜索页面上的分页按钮用于调用自身的回发(ShopAjaxSearch)并处理服务器端的分页。但如果它完全回发,它实际上会发布到ShopAjax页面,目标事件将不存在。
在您的场景中,最简单的解决方案可能只是一个asp更新面板,以便您可以利用已构建到某些WebForm控件中的分页