Has anyone seen this error before?

Last post 10-23-2006 4:16 PM by farmas. 3 replies.

Sort Posts:

  • Has anyone seen this error before?

    10-23-2006, 12:21 AM
    • Member
      10 point Member
    • pro1978
    • Member since 03-09-2006, 2:04 AM
    • Posts 2

    Sys.WebForms.PageRequestManagerParseErrorException. The message received from the server can not be parsed.  I receive this message when my update panel tries to refresh using a timer. The update panel and timer are contained within a user control and the user control is in a web zone on my main page. Here is the code for the user control.

    <%@ Control Language="VB" ClassName="Secondarily" %>

    <%@ import namespace="System.Data" %>

    <script runat="server">

     

    Sub DisplayMyTest()

    Dim cnMyTest As SqlClient.SqlConnection

    Dim cmdMyTest As SqlClient.SqlCommand

    Dim drMyTest As SqlClient.SqlDataReader

    Dim SQLString As String

    Dim RelativeURL As String

    cnMyTest = New SqlClient.SqlConnection("Data Source=Test;Initial Catalog=Test_Develop;Persist Security Info=True;User ID=")

    cnMyTest.Open()

    SQLString = "exec proMyTest 'me'"

    cmdMyTest = New SqlClient.SqlCommand(SQLString, cnMyTest)

    drMyTest = cmdMyTest.ExecuteReader()

    If drMyTest.HasRows = True Then

    While drMyTest.Read()

    If Left(drMyTest.Item("PageURL"), 3) = "../" Then

    RelativeURL = Right(drMyTest.Item("PageURL"), (Len(drMyTest.Item("PageURL")) - 3))

    Else

    RelativeURL = drMyTest.Item("PageURL")

    End If

    Response.Write("<li><a href='" & RelativeURL & "'>" & drMyTest.Item("MenuName") & " - " & drMyTest.Item("PageName") & "</a></li>")

    'Response.Write("***" & Request.)

    End While

    Else

    Response.Write("No Recent Additions")

    End If

    drMyTest.Close()

    cnMyTest.Close()

    End Sub

     

    </script>

    <asp:updatepanel id="upTest" runat="server" updatemode="Conditional">

    <triggers><asp:asyncpostbacktrigger controlid="tmr3" eventname="Tick" /></triggers>

    <contenttemplate>

    <% Call DisplayMyTest()%>

    </contenttemplate>

    </asp:updatepanel>

    <asp:timer id="tmr3" runat="server" interval="3000">

    </asp:timer>

  • Re: Has anyone seen this error before?

    10-23-2006, 12:58 PM
    • Participant
      1,108 point Participant
    • farmas
    • Member since 08-05-2002, 8:19 AM
    • Redmond, WA
    • Posts 246
    • AspNetTeam

    Hello there, I haven't run through your full repro, but using Response.Write during an async post is not supported and will result in the PageRequestManagerParseErrorException that you are seeing. If you need to write out stuff during an async post, you need to modify a piece of markup or control that is inside an UpdatePanel that is being refreshed, maybe a Literal control.

    - Federico

  • Re: Has anyone seen this error before?

    10-23-2006, 3:46 PM
    • Member
      10 point Member
    • pro1978
    • Member since 03-09-2006, 2:04 AM
    • Posts 2

    Thanks for the help. How would you recommend I go about displaying the results of my stored procedure without using the response.write to write out the values?

     

    Once again thanks

  • Re: Has anyone seen this error before?

    10-23-2006, 4:16 PM
    Answer
    • Participant
      1,108 point Participant
    • farmas
    • Member since 08-05-2002, 8:19 AM
    • Redmond, WA
    • Posts 246
    • AspNetTeam

    If you are debugging general functionality, one easy thing to do is to set EnablePartialRendering="false" on ScriptManager which will revert to regular posts, even if there are UpdatePanels on the page, Respose.Write will work then. Once everything works, flip back the boolean and remove Response.Write.

     If you want to do this during an async post, then you could add an asp:Literal control inside an UpdatePanel that has UpdateMode="Always". Then rewrite your Response.Write, with Literal1.Text+="piece of text". When the async post returns, it will refresh the literal with the values.

     - Federico

Page 1 of 1 (4 items)