首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

web页面 gridview自动刷新的有关问题

2014-01-13 
web页面 gridview自动刷新的问题用vs2010自带的ajax控件自动刷新gridview,刚开始测试是成功的,后来系统正

web页面 gridview自动刷新的问题
用vs2010自带的ajax控件自动刷新gridview,刚开始测试是成功的,后来系统正式运行后自动刷新失败,贴上前台代码(body块),请各位大神帮忙看看是哪里的问题?还有自动刷新失败是否关系到后台代码?
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div id="tool">
        <table>
            <tr>
                <td>
                </td>
                <td id="tooltext">
                    XXXX
                </td>
            </tr>
        </table>
    </div>
     
    <div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Timer ID="Timer1" runat="server" Interval="1000">
            </asp:Timer>
            <div  style="margin-top:3px">
                <asp:GridView ID="gdvRead" runat="server" AutoGenerateColumns="False" CellPadding="1"
                    ForeColor="#333333" GridLines="None" AllowPaging="True" PageSize="15" Font-Size="11px"
                    HorizontalAlign="Center" OnRowDataBound="gdvRead_RowDataBound" 
                     >
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:BoundField DataField="code" HeaderText="XX" ReadOnly="True">
                            <ItemStyle Width="60px" />
                        </asp:BoundField>
                        <asp:HyperLinkField HeaderText="XX" Text="XX" DataNavigateUrlFields="code" DataNavigateUrlFormatString="QC2_baoyandan_chuli.aspx?id={0}"
                            Target="iframeMain" NavigateUrl="QC2_baoyandan_chuli.aspx" DataTextField="gongxu">
                            <ControlStyle Font-Bold="True" Font-Underline="False" />
                            <ItemStyle Width="200px" />
                        </asp:HyperLinkField>
                        <asp:BoundField DataField="changfang" HeaderText="XX" ReadOnly="True">
                            <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="neirong" HeaderText="XX" ReadOnly="True">


                            <ItemStyle Width="320px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="leibie" HeaderText="XX" ReadOnly="True">
                            <ItemStyle Width="180px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="qc1time" HeaderText="XX" ReadOnly="True">
                            <ItemStyle Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="qc1name" HeaderText="QC1" ReadOnly="True">
                            <ItemStyle Width="60px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="qc2name" HeaderText="QC2" ReadOnly="True">
                            <ItemStyle Width="90px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bulu" HeaderText="补录" ReadOnly="True" Visible="false" />
                    </Columns>
                    <RowStyle ForeColor="#333333" HorizontalAlign="Center" BackColor="#F7F6F3" 
                        Height="30px" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" 
                        HorizontalAlign="Center" Height="18px" />
                    <PagerSettings Visible="False" />
                </asp:GridView>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <br />
    <div id="page">
        <asp:LinkButton ID="lnkbtnFrist" runat="server" OnClick="lnkbtnFrist_Click">首页</asp:LinkButton>
        <asp:LinkButton ID="lnkbtnPre" runat="server" OnClick="lnkbtnPre_Click">上一页</asp:LinkButton>
        <asp:Label ID="lblCurrentPage" runat="server"></asp:Label>
        <asp:LinkButton ID="lnkbtnNext" runat="server" OnClick="lnkbtnNext_Click">下一页</asp:LinkButton>
        <asp:LinkButton ID="lnkbtnLast" runat="server" OnClick="lnkbtnLast_Click">尾页</asp:LinkButton>
        跳转到第<asp:DropDownList ID="ddlCurrentPage" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCurrentPage_SelectedIndexChanged">
        </asp:DropDownList>


        页 共计<asp:Label ID="labCount" runat="server" Text=""></asp:Label>条数据</div>
    </div>
    
    </form>
</body>

[解决办法]
你后台代码有判断if(IsPostBack)么?
另外,断点调试下。看看是哪里出错。
[解决办法]
目测 该代码不能自动刷新。 你后台设置了timer 还是怎么的

热点排行