protected void Button2_Click(object sender, EventArgs e) { try { bl.comp_nm = TextBox1.Text; bl.nick_nm = txt_nik.Text; bl.cont_per_nm = txt_con_nm.Text; bl.contact_no = TextBox13_ph.Text; bl.grp_id = Convert.ToInt32(dwd_grp.SelectedValue.ToString()); bl.address1 = txt_add1.Text; bl.address2 = txt_add2.Text; bl.state_id = Convert.ToInt32(dwd_st.SelectedValue.ToString()); bl.city_id = Convert.ToInt32(dwd_ct.SelectedValue.ToString()); bl.vat = txt_vat.Text; bl.st = txt_st.Text; if (cst_crft.HasFile) { string filename = Path.GetFileName(cst_crft.FileName); string ex = Path.GetExtension(cst_crft.FileName); cst_crft.SaveAs(Server.MapPath("~/img/") + TextBox1.Text + "cst." + ex); filename = "img/" + TextBox1.Text + "cst." + ex; bl.cst_attch = filename; } if (vat_crft.HasFile) { string filename = Path.GetFileName(vat_crft.FileName); string ex = Path.GetExtension(vat_crft.FileName); cst_crft.SaveAs(Server.MapPath("~/img/") + TextBox1.Text + "vat." + ex); filename = "img/" + TextBox1.Text + "vat." + ex; bl.vat_attch = filename; } bl.vatdate = txt_vat_dt.Text; bl.pin_code = txt_pin.Text; bl.cst = txt_cst.Text; bl.ecc = TextBox5_ecc.Text; bl.tds = txt_tds.Text; bl.pan = txt_pan.Text; bl.bank_nm = txt_b_nm.Text; bl.ac_no = txt_acno.Text; bl.branch = txt_bch.Text; bl.ifsc_no = txt_i.Text; bl.bsr = txt_bsr_cmp.Text; bl.credit_limit = txt_crd_limit.Text; dl.insert_company(bl); ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('Company Created successfully'); window.location='company_master.aspx';", true); } catch { } }