简体   繁体   中英

“The message received from the server could not be parsed.” due to Label value assignment?

I am having one weird problem and it took me a couple of days to find the root cause and I am not able to make any sense out of it. The application crashes and gives: "Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."

I read about the error and no I am not using: Response.Write, Filters...etc

Application: ASP.Net Web application, .Net 4, and IIS 7.0. In one page I have an AJAX tab control (within an update panel) and this error is thrown when I am changing tabs.

The error is being thrown because of some assignment statements to the asp.net labels! here is my ASP.Net code (I cant put the whole page so this is just the segment that I think gives the error):

    <asp:Panel ID="pnlLocInfo" runat="server">                                          
    <div style="float: left; margin-left: 12%">
        <p style="font-size: medium">
            <b>As requested</b></p>
    </div>
    <div style="float: left; margin-left: 17%">
        <p style="font-size: medium">
            <b>Current</b></p>
    </div>
    <div style="width: 45%; font-size: small; margin-left: 5%">
        <div style="width: 30%; float: left; margin-right: 20px">
                <b>District:</b>
                <asp:Label runat="server" ID="lblARDist" Text="1"></asp:Label>
                <br />                                                        
                <b>Route:</b>
                <asp:Label runat="server" ID="lblARRte" Text="US-30"></asp:Label>
                <br />                                                       
                <b>Ref post:</b>
                <asp:Label runat="server" ID="lblARRefPost" Text="85"></asp:Label>
                <br />                                                      
                <b>Direction:</b>
                <asp:Label runat="server" ID="lblARDir" Text="North"></asp:Label>
                <br />                                                        
                <b>Section:</b>
                <asp:Label runat="server" ID="lblARSec" Text="17"></asp:Label>
                <br />                                                       
                <b>Range:</b>
                <asp:Label runat="server" ID="lblARRange" Text="R23W"></asp:Label>
        </div>
        <div style="width: 35%; float: left">
                <b>County:</b>
                <asp:Label runat="server" ID="lblARCnty" Text="85 - Story"></asp:Label>
                <br />
                <b>Priority:</b>
                <asp:Label runat="server" ID="lblARPriClass" Text="1"></asp:Label>
                <br />
                <b>Offset:</b>
                <asp:Label runat="server" ID="lblARoffset" Text="5"></asp:Label>
                <br />
                <b>Side:</b>
                <asp:Label runat="server" ID="lblARSide" Text="Left"></asp:Label>
                <br />
                <b>Twnshp:</b>
                <asp:Label runat="server" ID="lblARTwnshp" Text="20"></asp:Label>
        </div>
    </div>
    <div style="width: 45%; font-size: small; float: left; left: 10px; border-left-style: solid;
        border-left-width: medium;">
        <div style="width: 30%; float: left; margin-left: 15px; margin-right: 20px">

                <b>District:</b>
                <asp:Label runat="server" ID="lblFRDist" Text="1"></asp:Label>
                <br />
                <b>Route:</b>
                <asp:Label runat="server" ID="lblFRRte" Text="US-30"></asp:Label>
                <br />
                <b>Ref post:</b>
                <asp:Label runat="server" ID="lblFRRefPost" Text="86"></asp:Label>
                <br />
                <b>Direction:</b>
                <asp:Label runat="server" ID="lblFRDir" Text="North"></asp:Label>
                <br />
                <b>Section:</b>
                <asp:Label runat="server" ID="lblFRSec" Text="17"></asp:Label>
                <br />
                <b>Range:</b>
                <asp:Label runat="server" ID="lblFRRange" Text="R23W"></asp:Label>
        </div>
        <div style="width: 35%; float: left; margin-left: 15px">
                <b>County:</b>
                <asp:Label runat="server" ID="lblFRCo" Text="85 - Story"></asp:Label>
                <br />
                <b>Priority:</b>
                <asp:Label runat="server" ID="lblFRPriClass" Text="1"></asp:Label>
                <br />
                <b>Offset:</b> 
                <asp:Label runat="server" ID="lblFRRefPost_Offset" Text="20"></asp:Label>
                <br />
                <b>Side:</b>
                <asp:Label runat="server" ID="Label40" Text="Left"></asp:Label>
                <br />
                <b>Twnshp:</b>
                <asp:Label runat="server" ID="lblFRTwnshp" Text="20"></asp:Label>
        </div>
        <asp:Button runat="server" ID="btnModifyLoc" Text="Update location" /></div>

    </asp:Panel>

And in my code behind (VB.Net) I just assign values to those labels:

lblARCnty.Text = objEntrancePermit.PermitLocation.County.ID
lblARDist.Text = objEntrancePermit.PermitLocation.District.ID
lblARDir.Text = objEntrancePermit.PermitLocation.DirectionOfTravel
lblARSide.Text = objEntrancePermit.PermitLocation.SideOfRoad
lblARRte.Text = objEntrancePermit.PermitLocation.Route.ID
...etc

If I comment out the assignment, my application would work fine, if I uncomment it it would give me the error!!

Any ideas or thoughts would be much appreciated

Thanks Jafar

For those who have a similar problem to mine, in my site I have an Oracle database and the cause of my error was an assignment statement that was assigning an empty/null Oracle char value to an ASP.Net label text property, if the char variable DID have a value the error wouldnt be triggered. I dont know why its causing the error but once I handled it, my page worked fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM