Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
显示javascript确认框,其中数据库获取的文本值已更改,然后在C中插入或更新#_Javascript_C#_Asp.net_Asp.net Ajax - Fatal编程技术网

显示javascript确认框,其中数据库获取的文本值已更改,然后在C中插入或更新#

显示javascript确认框,其中数据库获取的文本值已更改,然后在C中插入或更新#,javascript,c#,asp.net,asp.net-ajax,Javascript,C#,Asp.net,Asp.net Ajax,我有一个具有唯一id的webform…因此,如果该id已被使用,那么我想请求用户确认,他/她是否想要更新以前的信息。 如果数据库中不存在id,则应执行insert操作 我还想在确认框中显示姓名和电话。。。 表示数据存在且名称为且电话号码为: protected void txtTIN_TextChanged(object sender, EventArgs e) { if (IsPostBack == true) { string firm_name =

我有一个具有唯一id的webform…因此,如果该id已被使用,那么我想请求用户确认,他/她是否想要更新以前的信息。 如果数据库中不存在id,则应执行insert操作

我还想在确认框中显示姓名和电话。。。 表示数据存在且名称为且电话号码为:

    protected void txtTIN_TextChanged(object sender, EventArgs e)
{
    if (IsPostBack == true)
    {
        string firm_name = "", place = "", mobile_no = "";
        SqlConnection con = new SqlConnection(conn);
        con.Open();
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = con;
        cmd.CommandText = "select Tin,Firm_Name,Place,Mobile_No from Cust_details where Tin='" + txtTIN.Text + "'";
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds);

        DataTableReader rd = ds.Tables[0].CreateDataReader();
        if (ds.Tables[0].Rows.Count > 0)
        {
            firm_name = rd.GetValue(0).ToString();
            place = rd.GetValue(1).ToString();
            mobile_no = rd.GetValue(2).ToString();
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('This TIN no already has data with Firm Name: ,Place: ,Mobile No: , Do you want to Update?')", true);
            Confirm(sender, e); //this should be a javascript function
            if (confirmValue == "Yes")//if javascript confirmation box returns Yes 
            {
                update(sender, e); //update the values
            }
            else
            {
                Response.Redirect("Details.aspx", true);//reload the page
            }
        }
        else
        {
            btnSubmit_Click(sender, e);  //Insert should be performed here
        }
    }
}

欢迎将您的代码示例放在您所尝试的内容上。访问链接看看这些对话框=>@ZaheerUlHassan在这里..我已经修改了