protected void country_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string c = country.Text;
                customer_registration_entity customer = new customer_registration_entity();
                customer_registration_bal    cust_bal = new customer_registration_bal();
                customer.Country_name = c;
                DataSet ds = cust_bal.populate_state_bl(customer);
                state.DataSource     = ds;
                state.DataTextField  = "state_name";
                state.DataValueField = "state_name";
                state.DataBind();
                state.Items.Insert(0, new ListItem("Select State", "0"));
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            cust_id.Text = GridView1.SelectedRow.Cells[1].Text;
            try
            {
                obj1.Customer_id = Convert.ToInt32(cust_id.Text);


                SqlDataReader rd1 = obj2.get_details_from_text_bl(obj1);
                if (rd1.HasRows)
                {
                    Label_U_Cust.Text = " ";
                    rd1.Read();
                    vendor_name1            = (rd1["vendor_name"].ToString());
                    vendor_type1            = (rd1["vendor_type"].ToString());
                    customer_name1          = (rd1["customer_name"].ToString());
                    contact_number1         = (rd1["contact_number"].ToString());
                    balance1                = (Convert.ToDecimal(rd1["balance"]));
                    email_id1               = (rd1["email_id"].ToString());
                    addres_details1         = (rd1["addres_details"].ToString());
                    country_id1             = (rd1["country_id"].ToString());
                    document_detail_number1 = (rd1["document_detail_number"].ToString());
                    registration_date1      = (rd1["registration_date"].ToString());
                    card_number1            = (rd1["card_number"].ToString());
                    vname_id.Enabled        = false;
                    vtype_id.Enabled        = false;
                    obj1.Country_id         = country_id1;
                    SqlDataReader rd2 = obj2.get_country_state_bl(obj1);

                    if (rd2.HasRows)
                    {
                        rd2.Read();
                        country_name1 = (string)rd2["country_name"];
                        state_name1   = (string)rd2["state_name"];
                    }

                    vname_id.Text    = vendor_name1;
                    vtype_id.Text    = vendor_type1;
                    cname_id.Text    = customer_name1;
                    contact_id.Text  = contact_number1;
                    balance_txt.Text = balance1.ToString();
                    email_id.Text    = email_id1;
                    add_id.Text      = addres_details1;
                    country_id.Text  = country_id1;
                    DropDownList_UCust_Country.SelectedIndex = DropDownList_UCust_Country.Items.IndexOf(DropDownList_UCust_Country.Items.FindByValue(country_name1));
                    {
                        string c = DropDownList_UCust_Country.Text;
                        customer_registration_entity customer = new customer_registration_entity();
                        customer_registration_bal    cust_bal = new customer_registration_bal();
                        customer.Country_name = c;
                        DataSet ds = cust_bal.populate_state_bl(customer);
                        DropDownList_UCust_State.DataSource     = ds;
                        DropDownList_UCust_State.DataTextField  = "state_name";
                        DropDownList_UCust_State.DataValueField = "state_name";
                        DropDownList_UCust_State.DataBind();
                        DropDownList_UCust_State.Items.Insert(0, new ListItem("Select State", "0"));
                    }
                    DropDownList_UCust_State.SelectedIndex = DropDownList_UCust_State.Items.IndexOf(DropDownList_UCust_State.Items.FindByValue(state_name1));
                    document_id.Text     = document_detail_number1;
                    registration_id.Text = registration_date1;
                    card_number.Text     = card_number1;
                    cust_id.Enabled      = false;

                    //rd2.Close();
                }
                else
                {
                    Label_U_Cust.Text = "Enter Valid Customer ID";
                    cust_id.Enabled   = true;
                }
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }
        protected void DropDownListVendor_id_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                obj1.Vendor_id = DropDownListVendor_id.SelectedValue;

                SqlDataReader rd1 = obj2.insert1(obj1);
                if (rd1.HasRows)
                {
                    rd1.Read();
                    Company_Registration_Number1 = (rd1["Company_Registration_Number"].ToString());
                    Vendor_Type1                 = (rd1["Vendor_Type"].ToString());
                    Vendor_Name1                 = (rd1["Vendor_Name"].ToString());
                    Certificate_Name1            = (rd1["Certificate_Name"].ToString());
                    Certificate_Issue_Date1      = (rd1["Certificate_Issue_Date"].ToString());
                    Certificate_Validation_Date1 = (rd1["certificate_validity_date"].ToString());
                    Year_Of_Establishment1       = (rd1["Year_Of_Establishment"].ToString());
                    Country1 = rd1["country_name"].ToString();
                    State1   = rd1["state_name"].ToString();

                    Address1        = (rd1["address_details"].ToString());
                    Contact_Number1 = (rd1["Contact_Number"].ToString());
                    Email_Id1       = (rd1["Email_Id"].ToString());
                    Website1        = (rd1["Website"].ToString());
                    Employee_Count1 = (rd1["employees_count"].ToString());
                    Customer_Count1 = (rd1["customer_count"].ToString());
                }


                c_r_n.Text            = Company_Registration_Number1;
                vendor_type.Text      = Vendor_Type1;
                vendor_name.Text      = Vendor_Name1;
                certificate_name.Text = Certificate_Name1;
                c_i_d.Text            = Certificate_Issue_Date1;
                c_v_d.Text            = Certificate_Validation_Date1;
                yoe.Text = Year_Of_Establishment1;

                DropDownList_UVend_Country.SelectedIndex = DropDownList_UVend_Country.Items.IndexOf(DropDownList_UVend_Country.Items.FindByValue(Country1));
                {
                    string d = DropDownList_UVend_Country.Text;
                    customer_registration_entity customer = new customer_registration_entity();
                    customer_registration_bal    cust_bal = new customer_registration_bal();
                    customer.Country_name = d;
                    DataSet ds = cust_bal.populate_state_bl(customer);
                    DropDownList_UVend_State.DataSource     = ds;
                    DropDownList_UVend_State.DataTextField  = "state_name";
                    DropDownList_UVend_State.DataValueField = "state_name";
                    DropDownList_UVend_State.DataBind();
                    DropDownList_UVend_State.Items.Insert(0, new ListItem("Select State", "0"));
                }
                DropDownList_UVend_State.SelectedIndex = DropDownList_UVend_State.Items.IndexOf(DropDownList_UVend_State.Items.FindByValue(State1));
                address.Text                  = Address1;
                contact_number.Text           = Contact_Number1;
                email_id.Text                 = Email_Id1;
                website.Text                  = Website1;
                emp_count.Text                = Employee_Count1;
                cust_count.Text               = Customer_Count1;
                DropDownListVendor_id.Enabled = false;
            }
            catch (Exception)
            {
                // Code that runs when an unhandled error occurs
                Exception exception = Server.GetLastError();

                // Response.Write("<h2>Global Page Error</h2>\n");

                // Response.Write("<p>" + exception.Message + "</p>\n");

                ExceptionClass.LogException(exception);

                Server.Transfer("~/ErrorPage.aspx?message=http " + exception.Message);

                // Clear the error from the server

                Server.ClearError();
            }
        }