protected void DropDownList_UCust_Country_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                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"));
            }
            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();
            }
        }