ASP .NET Ajax UpdatePanel Sys.WebForms.PageRequestManagerParserErrorException

时间:2011-05-26 14:56:52

标签: asp.net

我搜索过,搜索过,搜索过。我在这里和其他论坛上看过很多关于类似问题的帖子。然而,他们似乎都没有帮助。我已经在下面发布了相关的asp和vb代码(请原谅我vb不是我的选择)。如果你查看vb代码,你会注意到我正在建立一个链接“

“Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息。此错误的常见原因是通过调用Response.Write(),响应过滤器,HttpModules修改响应时,或服务器跟踪已启用。详细信息:在“7.180 / test / Members / Widget / bob”> leader de'附近解析时出错。

<asp:UpdatePanel ID="updatePanel" runat="server">
        <Triggers><asp:AsyncPostBackTrigger ControlID="searchBtn" EventName="Click" /></Triggers>
        <ContentTemplate>
            <asp:HiddenField ID="focusTab" runat="server" Value="" />
            <div id="tabs" class="tabsContainer">
                <ul>
                    <li id="c2Link"><a href="#c2Tab">bill</a></li>
                    <li id="intelLink"><a href="#intelTab">bob</a></li>
                    <li id="manLink"><a href="#manTab">man</a></li>
                    <li id="firesLink"><a href="#firesTab">fire</a></li>
                    <li id="protLink"><a href="#protTab">joe</a></li>
                    <li id="sustLink"><a href="#sustTab">jill</a></li>
                </ul>                
                <div id="c2Tab" class="panel">
                    <asp:Label ID="c2Results" runat="server" Text="No results found in this category."></asp:Label>
                </div>
                <div id="intelTab" class="panel">
                    <asp:Label ID="intelResults" runat="server" Text="No results found in this category."></asp:Label>
                </div>
                <div id="manTab" class="panel">
                    <asp:Label ID="manResults" runat="server" Text="No results found in this category."></asp:Label>
                </div>
                <div id="firesTab" class="panel">
                    <asp:Label ID="firesResults" runat="server" Text="No results found in this category."></asp:Label>
                </div>
                <div id="protTab" class="panel">
                    <asp:Label ID="protResults" runat="server" Text="No results found in this category."></asp:Label>
                </div>
                <div id="sustTab" class="panel">
                    <asp:Label ID="sustResults" runat="server" Text="No results found in this category."></asp:Label>
                </div>   
            </div>
        </ContentTemplate>
   </asp:UpdatePanel>

   <span class="kwSearchHdr">Search (seperate keywords w/comma)</span>
   <asp:TextBox ID="kwSearchTxt" runat="server" CssClass="kwSearchBx"/>  

   <span class="dateHdr">From/To Date</span>           
   <asp:TextBox ID="fromDateTxt" runat="server" CssClass="fromDate"/>
   <asp:TextBox ID="toDateTxt" runat="server" CssClass="toDate"/>

   <asp:Button ID="searchBtn" runat="server" Text="Search" CssClass="searchBtn"/>

VB代码:返回的字符串附加到其中一个标签

Private Function buildResultStr(ByVal result As AdvisorInsightView) As String
    Dim resultsStr As String = ""
    Dim baseUrl As String = "./WidgetViewInsight.aspx?Insight={0}"
    Dim text As New TextFunctions
    Dim snippet As String = ""
    Dim member As New JCISFAMember(Convert.ToInt16(result.Author))

    resultsStr += "<p>- <a href='"
    'resultsStr += Page.ResolveUrl(String.Format(baseUrl, result.InsightID))
    resultsStr += "' style='font-size:11;' >"
    resultsStr += result.Subject & "</a>, "
    resultsStr += Convert.ToDateTime(result.PubDate).ToShortDateString() & ", "
    resultsStr += member.GetAuthorDetails() & "<br />"

    snippet = text.stripRichTextFormatting(result.Observation)

    If snippet.Length > MAX_SNIP_LEN Then
        snippet = snippet.Substring(0, MAX_SNIP_LEN) & "..."
    End If

    resultsStr += snippet & "<br />"
    resultsStr += "<b>Keywords: </b>"

    If result.Keywords.Equals("") Then
        resultsStr += "None.</p>"
    Else
        resultsStr += "<span class='keywords'>"
        Dim keywords As String() = Split(result.Keywords, ", ")
        Dim keywordStr As String = ""
        Dim charCount As Integer = 0

        For i As Integer = 0 To keywords.Length - 1
            If charCount + keywords(i).Length >= 75 Then
                keywordStr += "..."
                Exit For
            End If
            Dim url As String = "bob" ' "./SearchResults.aspx?CategoryID=" & keywords(i)
            keywordStr += "<a href='" & url & "'>" & keywords(i) & "</a>"

            If i <> keywords.Length - 1 Then
                keywordStr += ", "
            End If
            charCount += keywords(i).Length
        Next

        resultsStr += keywordStr & "</span></p>"
    End If

    Return resultsStr
End Function

2 个答案:

答案 0 :(得分:1)

事实证明问题是我插入了部分网址或路径(例如href =“。/ WebPage.aspx”)。这会导致浏览器填写其余的url,这是通过写出响应来完成的,因此会导致问题。 I.E.为了解决这个问题,我必须构建一个完整的uri来放入服务器端的href字段,以便停止并写入响应。

答案 1 :(得分:0)

这是一个黑暗中的短片,但我遇到了我正在使用的自定义控件的问题。尝试将此添加到您的代码后面(表单加载),看看这是否有所作为

Page.Form.Method = "post";
        Page.Form.Enctype = "multipart/form-data";