无法使用asp:update正确更新gridview

时间:2013-10-10 14:37:07

标签: jquery html asp.net css vb.net

我正在使用Visual Studio Express 2012 for web中的内部网站,该网站将包含1-6个gridview表,可以发布从SQL服务器提取的动态信息。该网站将用作(通常)非交互式信息屏幕。我使用了一个名为“Jscroller2”的Jquery插件来自动滚动这些网格视图。

我的问题是让gridview动态更新。我正在尝试使用ASP:Updatepanel方法(mastersite页面包含asp:scriptmanager代码,但我在scriptmanagerproxy中进行了测量)以动态更新gridview。当更新“发生”时,滚动停止1/2秒,但即使数据库中的信息已更改,也不会发生任何其他情况。

我已经四处寻找解决方案,在这个网站和其他网站上,我没有成功完成他们的试错编码修复,所以我想我会问。这也是我第一次真正使用CSS,JS / Jquery,asp.net和vb.net,所以对我很轻松。

感谢任何和所有帮助!

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
</asp:ScriptManagerProxy> 
<%-- Div Container that holds all of the GridViews, Conections, and Parameters --%>
<div style="height: 704px; width: 1920px">
    <%-- Code for dbo.TrailerProfile from SQL Server --%>

    <%-- Div Container with styling, float, and margin options Overflow is set to auto --%>
    <div style="height:345px; width:620px; float:left; margin:0 10px 10px 0;     overflow:hidden"}>
        <table border="1" style="width:620px; border-collapse:collapse">
            <tr class="TableTop">
                <td style="width:620px; text-align: center; font-size: x-large;" class="auto-style10">   <strong>Trailer</strong></td>
            </tr>
        </table>
        <table border="1" style="width: 620px; border-collapse: collapse"; >
            <tr class="TableHeader">
                <td style="width: 158px" class="auto-style7">Trailer Number</td>
                <td style="WIDTH: 114px" class="auto-style8">Status</td>
                <td style="WIDTH: 114px" class="auto-style9">Schedule Status</td>
                <td style="WIDTH: 126px" class="auto-style5">Available Date</td>
                <td style="WIDTH: 124px" class="auto-style19">Available City</td>
            </tr>
        </table>

        <%-- Calling the Javascript JScroller2, used to make the Grid auto scroll --%>
        <link rel="stylesheet" type="text/css" href="jscroller2-1.0.css">
        <script type="text/javascript" src="Scripts/jscroller2-1.61.js"></script>
        <div id="scroller_container2" class="grid">
            <div class="jscroller2_up rnd1 jscroller2_speed-65">

                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Timer ID="Timer1" runat="server" Interval="10000" ontick="Timer1_Tick">    </asp:Timer>

                        <%-- ASP Gridview function calls columns out of the dbo.TrailerProfile table --%>
                        <asp:GridView ID="Grid1" runat="server" showheader="false"  width="100%"  Classcss="gv1" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Style="font-size: large; text-align: center;" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical">
                            <AlternatingRowStyle BackColor="White"></AlternatingRowStyle>
                            <Columns>
                                <asp:BoundField DataField="trl_number" HeaderText="trl_number" SortExpression="trl_number"></asp:BoundField>
                                <asp:BoundField DataField="trl_status" HeaderText="trl_status" SortExpression="trl_status"></asp:BoundField>
                                <asp:BoundField DataField="trl_sch_status" HeaderText="trl_sch_status" SortExpression="trl_sch_status"></asp:BoundField>
                                <asp:BoundField DataField="trl_avail_date" HeaderText="trl_avail_date" SortExpression="trl_avail_date"></asp:BoundField>
                                <asp:BoundField DataField="trl_avail_city" HeaderText="trl_avail_city" SortExpression="trl_avail_city"></asp:BoundField>
                            </Columns>
                        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                    </Triggers>
                </asp:UpdatePanel>
            </div> 
        </div>
    </div>
</div>

VB代码:

Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
    Grid1.DataBind()
End Sub

0 个答案:

没有答案