我有以下HTML代码: -
<telerik:RadSplitter ClientIDMode="Static" ID="RadSplitter1" runat="server" PanesBorderSize="0" BorderSize="0"
Width="100%" Height="100%" Orientation="Vertical" CssClass="radSplitterCss" HeightOffset="98">
<telerik:RadPane ID="RadPane2" runat="server" Width="293px" Height="100%" BackColor="white"
CssClass="radLeftPane">
<uc1:UCMainMenu ID="UCMainMenu1" runat="server" />
</telerik:RadPane>
<telerik:RadSplitBar ID="RadSplitbar2" runat="server" Width="1%" CollapseMode="Forward" CssClass="radSplitBar" >
</telerik:RadSplitBar>
<telerik:RadPane ID="RadPane3" runat="server" BackColor="white" CssClass="radRightPane" >
<div class="mainContent">
<asp:ContentPlaceHolder ClientIDMode="Static" runat="server" ID="MainContent" />
</div>
</telerik:RadPane>
</telerik:RadSplitter>
和UCMainMenu的代码如下: -
<asp:UpdatePanel runat="server" ID="MainMenuUP" UpdateMode="Conditional">
<ContentTemplate>
<div id="mainMenu">
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" Width="100%" Height="100%" OnItemDataBound="ItemDataBound" >
<ExpandAnimation Type="None" />
</telerik:RadPanelBar>
</div>
</ContentTemplate>
</asp:UpdatePanel>
现在我有一些JQuery,要进行搜索,它应该在没有任何页面刷新的情况下过滤菜单(这就是我包含UpdatePanel的原因)。
$("#reports_textSearch").keyup(function () {
var textLength = $(this).val().length;
delay(function () {
if (textLength == 0) {
emptySearchString();
}
if (textLength > 2) {
var args = {
reportName: document.getElementById('reports_textSearch').value
};
doSearchString(args);
}
}, 1000);
});
function doSearchString(args) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Dashboard.aspx/FetchReports",
data: JSON.stringify(args),
dataType: "json",
success: function (data) {
__doPostBack('#MainMenuUP', data.d);
},
error: function (data) {
}
});
}
问题是在Firefox中,它第一次进行刷新但之后不再刷新,而在IE中,它一直刷新整个页面。
我该如何解决这个问题?
感谢您的帮助和时间
------------------- UPDATE --------------------------- ----------------------------- 找到1个问题,改变: -
//__doPostBack('#MainMenuUP', data.d);
__doPostBack('<%= MainMenuUP.ClientID %>', data.d);
页面刷新消失了。但是,另一段JQUERY代码现在不能正常工作: -
$('.rpItem').on("click", "img", function (e) {
var text = $(this).siblings('span.rpText').text();
//e.preventDefault();
//e.stopPropagation();
var args = {
reportName: text
};
$.ajax({
type: "POST",
url: "Dashboard.aspx/AddToFavourites",
data: JSON.stringify(args),
contentType: "application/json;charset=utf-8;",
success: function (data) {
//__doPostBack('#MainMenuUP', text);
__doPostBack('<%= MainMenuUP.ClientID %>', text);
},
error: function () {
}
});
});
仍在尝试解决此问题