是這樣的:我要做改版的功能(已實現),但是我要在保存時(txtbox判斷),做提示信息。
半天了,沒做出來,各位給點意見吧!

解决方案 »

  1.   

    哪里不清楚?
    我只要在保存之前加入提示信息,要怎么做
    這是Btn_save_Click
    string sqlstr = "select *from link where ConnID='" + this.Txt_ID.Text + "'";
     SqlDataAdapter da = new SqlDataAdapter(sqlstr, conn);
     dataTable dt = new DataTable();
     da.Fill(dt);
    //改版
     if (dt.Rows.Count == 1)
       {
               //Btn_save.Visible = false;
                string a = dt.Rows[0]["ConnID"].ToString();
                string b = dt.Rows[0]["fact_id"].ToString();
                        sid = a + "R1";
                       if (IsValidEmail(this.Txt_ID.Text))
                        {
                            string sql1 = "update link set ConnID='" + sid + "' where fact_id='" + b + "' and ConnID='" + a + "'";
                            SqlCommand cmd1 = new SqlCommand(sql1, conn);
                            try
                            {
                                conn.Open();
                                if (cmd1.ExecuteNonQuery() > 0)
                                {
                                    cmd1.Connection.Close();
                                    RegisterStartupScript("", "<script language='javascript'>alert('版本更新成功!');window.location.reload('ConnList.aspx');</script>");
                           catch (Exception ex)
                            {
                                Response.Write("<" + "script>alert('查詢數據錯誤');</" + "script>" + ex.Message);
                            }
                            conn.Close();
                        }
                        else
                        {
                            RegisterStartupScript("", "<script language='javascript'>alert('你輸入的格式不對,請核對!');</script>");
                        }
                    }
      

  2.   

    什么意思?是要提示用户是否保存吗?
    用return confirm不行吗?
      

  3.   

    是要用return confirm,可是不知道用在哪里?
    在Btn_save_Click 里面用肯定不行的
      

  4.   

    试试window.confirm(),好像是这样的哈:
    if(confirm('are you sure?')==true) 

      window.location.href='upinfo2.asp'; 
    }
    else

      window.location.href = "index2.asp" ; 
    } 如果不能满足,就把你的button控件(button1)改为客户端的,再加一个隐藏的服务器端的button控件(button2)
    用button1触发一个js函数,如果通过就触发button2,不通过就不触发并提示。
      

  5.   

    在Btn_save_Click 的OnClientClick属性里加
      

  6.   

    liujinyang0511
     我試過了,不成功
      

  7.   

    在合适的代码位置 Response.Write("<script>alert('已完成!')</script>");
      

  8.   

    按钮OnClientClick属性添加.
    這個也行不通的,此按鈕事件有保存和改版本功能,保存的時候不要有提示信息啊!