1

我有以下 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 中,它一直在刷新整个页面。

我怎样才能解决这个问题?

感谢您的帮助和时间

- - - - - - - - - -更新 - - - - - - - - - - - - - - - -------------------------- 找到了 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 () {
            }
        });
    });

仍在努力解决这个问题

4

0 回答 0