将更新面板与GridView一起使用时出现错误 [英] Getting Error while using Update Panel with GridView

查看:92
本文介绍了将更新面板与GridView一起使用时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 在带有GridView的页面中使用UpdatePanel时出现错误
我的代码是

Hi I am getting error while am using UpdatePanel in the Page with GridView
My code is

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID="scriptmanagernew" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="updatepanelnew" runat="server"><ContentTemplate>
    <table border="0" cellspacing="0" cellpadding="0" style="width: 949px">
        <tr>
            <td width="220" valign="top">
                <table width="220" border="0" align="center" cellpadding="0" cellspacing="0" class="Sidemenu_bottem">
                    <tr>
                        <td colspan="3" valign="middle" class="Quicklink_top">
                            <table width="163" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="32" height="33">
                                    </td>
                                    <td width="131">
                                        Careers
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td width="9" height="300">
                            &nbsp;
                        </td>
                        <td width="217" valign="top">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td height="20">
                                        <a href="joinourteam.htm" class="submenu" target="_top">Join our team</a>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="20">
                                        <a href="explorejobs.aspx" class="submenu"><strong>Explore jobs</strong> </a>
                                    </td>
                                </tr>
                                <tr>
                                    <td id="tdRegisterNow" runat="server" visible="false" height="20">
                                        &nbsp;&nbsp;&nbsp; <a href="UserRegistration.aspx" class="submenu">
                                            Register now</a>
                                    </td>
                                </tr>
                                <tr>
                                    <td id="tdMyProfile" runat="server" height="20">
                                        &nbsp;&nbsp;&nbsp; <a href="UserLogin.aspx" class="submenu">My
                                            Profile</a>
                                    </td>
                                </tr>
                                <tr>
                                    <td id="tdViewJobs" runat="server" visible="false" height="20">
                                        &nbsp;&nbsp;&nbsp; <a href="ViewJobs.aspx" class="submenu">Applied Jobs
                                            </a>
                                    </td>
                                </tr>
                                <tr>
                                    <td id="tdMyAccount" runat="server" visible="false" height="20">
                                        &nbsp;&nbsp;&nbsp; <a href="MyAccount.aspx" class="submenu">
                                            My Account</a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td width="10">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </td>
            <td width="729" valign="top" align="center">
                <table width="670" border="0" align="center" cellpadding="0" cellspacing="0" class="innertextbox_bottem">
                    <tr>
                        <td colspan="3" class="innertextbox_top">
                            <table style="height: 10px" cellpadding="5">
                                <tr style="border-style: outset">
                                    <td align="left" width="340">
                                        <span class="innerpage-header">&nbsp;&nbsp;Explore jobs</span>
                                    </td>
                                    <td align="right" width="250">
                                        <asp:Label class="LoginData" ID="lblUserName" runat="server"></asp:Label>
                                    </td>
                                    <td width="60">
                                        <asp:LinkButton class="LoginData" ID="lnkLogOut" runat="server" Visible="False" OnClick="lnkLogOut_Click">&lt;Logout&gt;</asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td width="12">
                            &nbsp;
                        </td>
                        <td width="650" valign="top" align="center" colspan="2">
                            <p align="center">
                                <asp:Label ID="lblApplied" runat="server" Visible="False" ForeColor="#3399FF"></asp:Label>
                            </p>
                            <p align="center">
                                Enter/Select one or more search criteria below to view the opportunities:
                            </p>
                            <asp:Panel ID="Panel1" runat="server">
                            <table align="center" border="0" cellpadding="3" cellspacing="0">
                                <tr>
                                    <td align="right" style="height: 23px">
                                        Keyword:
                                    </td>
                                    <td align="left" style="height: 23px">
                                        <asp:TextBox ID="txtKeyword" runat="server" Width="170px"></asp:TextBox>
                                    </td>
                                    <td width="170Px" align="left" style="height: 23px">
                                        Ex: vb,dotnet,java,c#.
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        Country:
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="True" Font-Size="Larger"

                                            Width="176px" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged">
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        State:
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlState" runat="server" Font-Size="Larger" Width="176px">
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3" align="center">
                                        <br />
                                        <asp:Button class="ASPbutton" ID="btnSearch" runat="server" Text="Search" CausesValidation="False"

                                            BackColor="Black" ForeColor="White" Width="65px" OnClick="btnSearch_Click"></asp:Button>
                                        &nbsp;&nbsp;&nbsp;
                                        <asp:Button class="ASPbutton" ID="btnClearSearch" runat="server" Text="Clear Search"

                                            CausesValidation="False" BackColor="Black" ForeColor="White" Width="100px" OnClick="btnClearSearch_Click">
                                        </asp:Button>
                                        <br />
                                        <br />
                                    </td>
                                </tr>
                            </table>
                                   </asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center" >
                            <asp:Panel ID="pnlDgJobDetailsFound" runat="server" ScrollBars="Auto"

                                Visible="false">
                                <asp:GridView ID="dgSrchJobDetailsFound" runat="server" align="center" AutoGenerateColumns="False"

                                    AllowSorting="True" Width="96%" CellPadding="3" ForeColor="#333333" DataKeyNames="JobId"

                                    GridLines="None" OnSelectedIndexChanged="dgSrchJobDetailsFound_SelectedIndexChanged">
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <Columns>
                                        <asp:CommandField CausesValidation="False" InsertVisible="False" ShowCancelButton="False"

                                            ShowSelectButton="True" />
                                        <asp:BoundField DataField="JobCode" HeaderText="JobCode" ReadOnly="True" />
                                        <asp:BoundField DataField="Title" HeaderText="Title" />
                                        <asp:BoundField DataField="CityName" HeaderText="Job Location" />
                                    </Columns>
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#999999" />
                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                </asp:GridView>
                                <br />
                            </asp:Panel>
                            <asp:Label ID="lblRecordsFound" runat="server" Text="" Visible="false" ForeColor="#0066FF"></asp:Label>
                            <br />
                            <br />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <asp:HiddenField ID="hfExplore" runat="server" />
    </ContentTemplate>
<pre lang="xml"><Triggers >
   <asp:AsyncPostBackTrigger ControlID="dgSrchJobDetailsFound" EventName="SelectedIndexChanged" />
   </Triggers>



</asp:UpdatePanel>
</asp:Content>


When I click on the select button, which is inside the gridview, I am getting the following error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.导致此错误的常见原因是通过调用Response.Write(),响应筛选器,HttpModules或服务器跟踪来修改响应.
Details: Error parsing near



</asp:UpdatePanel>
</asp:Content>


When I click on the select button, which is inside the gridview, I am getting the following error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near

推荐答案

Have a look at various possible reasons and resolutions for the same here[^]. Few useful links from it:
Link 1[^]
Link 2[^]
Link 3[^]
Have a look at various possible reasons and resolutions for the same here[^]. Few useful links from it:
Link 1[^]
Link 2[^]
Link 3[^]


Use PostBackTrigger instead of AsyncPostBackTrigger. For more info have a look at these.

Link 1[^]
Link 2[^]
Use PostBackTrigger instead of AsyncPostBackTrigger. For more info have a look at these.

Link 1[^]
Link 2[^]


这篇关于将更新面板与GridView一起使用时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆