JS中弹出确定和取消对话框并跳转页面

项目需求是查询,如果查询的值的结果为空,则跳转到另外一个页面曾新,并把查询的条件传入到新增页面

首先定义全局变量RepaterIsNull,用来标记Repeater是否为空:

private bool RepaterIsNull;

判断DataTable是否为空:

DataTable dt = bll.Search(tbSearch.Text.Trim(), aspNetPage.PageSize, aspNetPage.CurrentPageIndex, out rdCnt);
            if (dt.Rows.Count <= 0)
            {
                RepaterIsNull = true; //DataTable为空
            }
            rpt_TelBook.DataSource = dt;
            aspNetPage.RecordCount = rdCnt;
            rpt_TelBook.DataBind();

定义一个弹出对话框并跳转的方法:

protected void PopUpManager(string body,string url)
    {
        string Script;

        Script = ("");

        System.Web.HttpContext.Current.Response.Write(Script);
    }

调用此方法:

protected void btnSeachPhoneNo_Click(object sender, EventArgs e)
    {
        GetTelBookList();
        string phonenumber = tbSearch.Text.Trim();
        if (RepaterIsNull)
        {
            string url = "AddTelBook.aspx?phonenumbervalues="+phonenumber;
            PopUpManager("没有此业主电话的行销记录,是否曾新?", url);
        }
    }

 

这个跳转方法参考与:http://www.zhixing123.cn/jsp/2547.html

转载于:https://www.cnblogs.com/New-world/archive/2012/04/26/2471607.html

你可能感兴趣的:(JS中弹出确定和取消对话框并跳转页面)