本文介绍了每10秒刷新一次页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有以下DataList的代码,而在c#中的代码却可以正常工作.

我试图弄清楚如何每10秒刷新一次页面,我想放置一个计时器,但不确定应该将它放在哪个位置.

有什么想法怎么做?谢谢

Hi,

I have following code for DataList and the code behind in c# it is working fine.

I am trying to figure out how to refresh the page it every 10 seconds, i was thinking of placing timer but not sure which place it should go.

Any ideas how to do it? Thanks

<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" CellSpacing="3"
    RepeatDirection="Horizontal"  HorizontalAlign="Left"
    DataKeyField="email" DataSourceID="SqlDataSource1" Width="900px"
    onselectedindexchanged="DataList1_SelectedIndexChanged">
    <itemtemplate>

              Skipping the code here which is working fine
                </itemtemplate>


在c#中


And in c#

protected void Page_Load(object sender, EventArgs e)
{
  email.Text = "" + Session["email"];
}

protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{

        if (!this.IsPostBack)
        {
            con.Close();
            con.Open();
            cmd = new SqlCommand("SELECT C, P FROM dr WHERE email='" + email.Text + "'", con);

            dr = cmd.ExecuteReader();

        }
}

推荐答案

<meta http-equiv="refresh" content="600"> 



http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm



http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm


<meta http-equiv="refresh" content="600">



这篇关于每10秒刷新一次页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 01:02