使用chrome和asp.net的奇怪结果

时间:2014-03-19 14:05:48

标签: asp.net google-chrome timer updatepanel

我正在建立一个使用带定时器触发器的更新面板的在线广播电台。当计时器触发时,后面的代码会更新标签和图像。它在FireFox和IE中运行良好,但在Chrome浏览器中查看网站时,该页面似乎正在重新加载整个网站,因此它看起来像闪烁。该网站为http://maxradio.stormtechnologies.biz

ASP.Net代码:

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="25000" />
    <asp:UpdatePanel ID="StockPricePanel" runat="server" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" />
    </Triggers>
    <ContentTemplate>
         <asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label>
         <asp:Table ID="MainTable" runat="server" BorderStyle="None" Width="100%">
            <asp:TableRow>
                <asp:TableCell VerticalAlign="Top" Width="320px">
                    <asp:Table ID="PlayingNow" runat="server" BorderStyle="None" CellPadding="0" CellSpacing="0" Width="100%">
                        <asp:TableRow BackColor="#4B6C9E"><asp:TableCell Font-Names="Verdana" ForeColor="#FFFFFF" Font-Size="Small">Now Playing</asp:TableCell></asp:TableRow>
                        <asp:TableRow>
                            <asp:TableCell HorizontalAlign="Center">
                                <asp:Image ID="Cover" runat="server" Height="300px" ImageAlign="Middle" Width="300px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1" />
                            </asp:TableCell>
                        </asp:TableRow>
                        <asp:TableRow>
                            <asp:TableCell HorizontalAlign="Center" VerticalAlign="Middle">
                                <asp:Label ID="song" runat="server" Text="empty" Font-Names="Verdana" Font-Size="Larger" ForeColor="Black" Font-Bold="True"></asp:Label><br />
                                <asp:Label ID="artist" runat="server" Text="empty" Font-Names="Verdana" Font-Size="Larger" ForeColor="Black"></asp:Label><br />
                            </asp:TableCell>
                        </asp:TableRow>
                    </asp:Table>
    </ContentTemplate>
    </asp:UpdatePanel>

代码背后:

        protected void Timer1_Tick(object sender, EventArgs e)
    {
        dbCon.iSongOld = Convert.ToInt32(Label1.Text);

        SQL = "SELECT MAX(ID) FROM historylist";
        dbCon.sqlCon.Open();
        SqlCommand cmd = new SqlCommand(SQL, dbCon.sqlCon);
        dbCon.iID = (int)cmd.ExecuteScalar();

        SQL = "SELECT songID FROM historylist WHERE (ID = '" + dbCon.iID + "')";
        SqlCommand cmd2 = new SqlCommand(SQL, dbCon.sqlCon);
        dbCon.iSong = (int)cmd2.ExecuteScalar();
        dbCon.sqlCon.Close();

        if (dbCon.iSong == dbCon.iSongOld)
            Label1.Text = dbCon.iSongOld.ToString();
        else
        {
        Label1.Text = dbCon.iSong.ToString();
        GetPlayingInfo(dbCon.iSong);
        GetQuedSongs();
        GetTopFive();
        GetRecentSongs();
        }

    }

0 个答案:

没有答案