a.aspx 后台操作完,输出===3秒后跳转到b.aspx代码在。cs中写就可以

解决方案 »

  1.   

    Response.Write( " <meta   http-equiv= 'refresh '   content= '3;url=b.aspx '> ");
      

  2.   

    既然是回馈信息,肯定是前台跳转,那么必然用js或meta
      

  3.   

    直接用timer就OK了...
    或者js倒计时...
    或者
    <meta http-equiv="refresh" content="3;url=Index.aspx">
      

  4.   

    Thread.Sleep(3);
    timert
    js
    都行!
      

  5.   

    <meta http-equiv="refresh" content="3;url=Index.aspx">
    介样
      

  6.   

    <meta http-equiv="refresh" content="3;url=Index.aspx">timer计时器也行
      

  7.   

    只有js和meta可以做到。你要用c#写3秒后,那前台页面会一直空白的
      

  8.   

    在Button1_Click方法的最后加入一行:System.Threading.Thread.Sleep(3000);
      

  9.   

    就是玩的酷一点,就像CSDN的发帖后,会倒计时3秒钟,这个时候,前台不是空白,会输出内容“修改成功,3秒后返回b页面”
    用timer 怎么写呢?
      

  10.   


    protected static void  reulr()
        {
           Redirect("brand.aspx");
        // 我这里写的不正确
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(_connstring);
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "update probrand set brandname=@brandname where brandid=@brandid ";
            cmd.Parameters.AddWithValue("@brandid",int.Parse(hidden1.Value));
            cmd.Parameters.AddWithValue("@brandname", TextBox1.Text);
            using (con)        {
                con.Open();
                cmd.ExecuteNonQuery();
                Label2.Text="品牌名已修改完!";            System.Threading.Thread.Sleep(1000);
                cmd.CommandText = "update procategory set brandname=@brandname where brandid=@brandid";
               
                cmd.ExecuteNonQuery();
                Label3.Text = "类别中的品牌名已修改完!";
                System.Threading.Thread.Sleep(1000);
                cmd.CommandText = "update newpro set brandname=@brandname where brandid=@brandid";           // cmd.CommandText = "update newpro set brandname=@brandname where brandid=@brandid";
             
          cmd.ExecuteNonQuery();
             Label4.Text = "所有产品中的品牌名已修改完!";         System.Threading.Thread.Sleep(1000);
            
             reulr();        }
      

  11.   

    跳转函数ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert(\'登录成功!\');setTimeout(function(){location.href='b.aspx'},1000);  </script>");
      

  12.   

    3秒的话,将1000该成3000就可以了ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert(\'登录成功!\');setTimeout(function(){location.href='b.aspx'},3000);  </script>");你不是加群了嘛,这样简单的问题群里人都可以回答的哦
      

  13.   

    Thread.Sleep(3);
    re...
    还是这个快速点 但是不科学
      

  14.   

    用了sleep 就不会显示输出的提示了
      

  15.   

     private string _connstring = WebConfigurationManager.ConnectionStrings["proconnectionstring"].ConnectionString;
        protected void Page_Load(object sender, EventArgs e)
        {        SqlConnection con = new SqlConnection(_connstring);
            SqlCommand cmd=new SqlCommand();
            cmd.Connection=con;
            cmd.CommandText="select * from pro";        SqlCommand cmd2 = new SqlCommand();
            cmd2.Connection = con;
            cmd2.CommandText = "insert into newpro (protitle,prosummary,procontent,proimg,addtime,clickcount,pagetitle,pagekeywords,pagedescriptions)values(@protitle,@prosummary,@procontent,@proimg,@addtime,@clickcount,@pagetitle,@pagekeywords,@pagedescriptions)";
            //SqlDataAdapter sda = new SqlDataAdapter(cmd);
            //DataSet dst = new DataSet();
            con.Open();
            
            SqlDataReader sdr = cmd.ExecuteReader();
            
            while (sdr.Read())
            {
                cmd2.Parameters.AddWithValue("@protitle", sdr["protitle"]);
                cmd2.Parameters.AddWithValue("@prosummary", sdr["prosummary"]);
                cmd2.Parameters.AddWithValue("@procontent", sdr["procontent"]);
                cmd2.Parameters.AddWithValue("@proimg", sdr["proimg"]);
                cmd2.Parameters.AddWithValue("@addtime", sdr["addtime"]);
                cmd2.Parameters.AddWithValue("@clickcount", sdr["clickcount"]);
                cmd2.Parameters.AddWithValue("@pagetitle",sdr["pagetitle"]);
                cmd2.Parameters.AddWithValue("@pagekeywords",sdr["pagekeywords"]);
                cmd2.Parameters.AddWithValue("@pagedescriptions",sdr["pagedescriptions"]);            cmd2.ExecuteNonQuery();
            
            }
            con.Close();
        }请问错在哪里?行 31:         while (sdr.Read())
    行 32:         {
    行 33:             cmd2.Parameters.AddWithValue("@protitle", sdr["protitle"]);
    行 34:             cmd2.Parameters.AddWithValue("@prosummary", sdr["prosummary"]);
    行 35:             cmd2.Parameters.AddWithValue("@procontent", sdr["procontent"]);
     源文件: d:\Gdent999\admin\oldtonew.aspx.cs    行: 33 
      

  16.   

    b/s通信是这样,B请求  S发送     ,3秒后B要重新请求S才能发送,3秒后怎么重新请求?代码都写在S端了,还请求个毛啊
      

  17.   

    Thead.Sleep的方式是不行的。
    这样页面一直不输出不返回。客户端一直空白。
    等你Thead.Sleep(3000)。  在这3秒内,前台页面一直空白,觉得这样有意思?只能用js或meta的。
      

  18.   

    我只是想要这样的效果,最好用c#写的,如果c#确定不行的话,js也可以,不过js我不会写啊
      

  19.   

    本帖最后由 net_lover 于 2011-04-10 14:14:48 编辑
      

  20.   

    也可以这样
    <script runat="server">  protected void Button1_Click(object sender, EventArgs e)
      {
        body.Attributes.Add("onload","setTimeout('window.location=\"b.aspx\"',3000)");
      }
    </script><html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body id="body" runat="server">
      

  21.   

    本帖最后由 net_lover 于 2011-04-10 14:20:23 编辑
      

  22.   


    Response.Write( " <meta http-equiv= 'refresh ' content= '3;url=b.aspx '> ");
    我记得这个只能用于静态页面 html htm..
      

  23.   


    在哪看的?aspx的结果就是html