protected void btnVendoradd_Click(object sender, EventArgs e)
    {
        ObjVendor.Vendorname    = txtvendorname.Text;
        ObjVendor.Contactperson = txtcontactperson.Text;
        ObjVendor.Insert();

        string myScript;

        myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>";
        Page.RegisterClientScriptBlock("MyScript", myScript);
    }
示例#2
0
    protected void btnVendoradd_Click(object sender, EventArgs e)
    {
        int count_vendor;

        count_vendor = ObjVendor.Get_Vendor_By_Vname(txtvendorname.Text.ToString());
        if (count_vendor == 0)
        {
            ObjVendor.Vendorname    = txtvendorname.Text;
            ObjVendor.Contactperson = txtcontactperson.Text;
            ObjVendor.Insert();
            BindGrid();
            lblerrmsg.Text = Resources.MessageResource.erradd.ToString();
        }
        else
        {
            lblerrmsg.Text = Resources.MessageResource.erralready.ToString();
        }
    }
    protected void btnVendoradd_Click(object sender, EventArgs e)
    {///Add Exception handilng try catch change by vishal 21-05-2012
        try
        {
            ObjVendor.Vendorname    = txtvendorname.Text;
            ObjVendor.Contactperson = txtcontactperson.Text;
            ObjVendor.Insert();

            string myScript;
            myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
        }
        catch (Exception ex)
        {
            string myScript;
            myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
            Page.RegisterClientScriptBlock("MyScript", myScript);
            return;
        }
    }