protected void Button_tj_Click(object sender, EventArgs e)
    {
          .....
        if (ds.Tables[0].Rows.Count == 0)
        {
              //在此处询问用户是否继续下去,然后决定程序是否走下去
             ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
             GridView1.DataSource = ds.Tables[0];
             GridView1.DataBind();
             int nColumnCount = GridView1.Rows[0].Cells.Count;
             GridView1.Rows[0].Cells.Clear();
             GridView1.Rows[0].Cells.Add(new TableCell());
             GridView1.Rows[0].Cells[0].ColumnSpan = nColumnCount;
             GridView1.Rows[0].Cells[0].Text = "无记录";
             GridView1.RowStyle.Height = 30;             GridView1.RowStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
        }
         .....
    }

解决方案 »

  1.   

    ClientScript.RegisterStartupScript(this.GetType(), "message", " <script language='javascript' >if(Confirm('确认码?'))document.getElementById('Hf').value='1'; else document.getElementById('Hf').value='0'; </script>"); 
    if(Hf.Value.Equals("1")) 
    { }
      

  2.   


    //下一步按钮点击后触发的程序
    protected v oid NextStepBtn_Click(object sender, EventArgs e)
    {
        //在此处询问用户是否继续下去,然后决定程序是否走下去
      ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
      GridView1.DataSource = ds.Tables[0];
      GridView1.DataBind();
      int nColumnCount = GridView1.Rows[0].Cells.Count;
      GridView1.Rows[0].Cells.Clear();
      GridView1.Rows[0].Cells.Add(new TableCell());
      GridView1.Rows[0].Cells[0].ColumnSpan = nColumnCount;
      GridView1.Rows[0].Cells[0].Text = "无记录";
      GridView1.RowStyle.Height = 30;  GridView1.RowStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
    }protected void Button_tj_Click(object sender, EventArgs e)
      {  if (ds.Tables[0].Rows.Count == 0)
      {
         nextStepBtn.Visible = true; //显示是否“下一步”按钮,等待用户点击,nextStepBtn.Visible默认设置为false
      }  }
      

  3.   

    不好意思,知道了 ,是HIDDENFIELD,我平时不用,所有不记得
      

  4.   

    if (ds.Tables[0].Rows.Count == 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", " <script language='javascript' >if(Confirm('确认码?'))document.getElementById('Hf').value='1'; else document.getElementById('Hf').value='0'; </script>");
                if (Hf.Value.Equals("1"))
                {
                    lastMonthData.Insert(intYear, intMonth, checkedDeptNum, UserID, out strMsg);
                    ds = null;
                    ds_count = null;
                    ds = dbSys.ExecuteDataSet(strSql, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize);
                    ds_count = dbSys.ExecuteDataSet(strSql);
                    AspNetPager1.RecordCount = ds_count.Tables[0].Rows.Count;
                }
                else
                {
                    return;
                }        }
    程序并没有提示出来,为什么?
      

  5.   

    ClientScript.RegisterStartupScript改成RegisterClientScriptBlock试试
    如果根据情况提示不同,那就需要你自己拼凑好js字符串,然后再弹出了
      

  6.   

    说一句实话,如何你是比如“是否要删除?”什么之类的话,上面的可以解决了,但是如果是更复杂的比如有多个确认的步骤,我想你还是要用AJAX来实现。