protected void Page_Load(object sender, EventArgs e)

    {
        if (Session["userid"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
        else
        {
            userid  = int.Parse(Session["userid"].ToString());
            Empname = Session["Empname"].ToString();
        }
        if (!IsPostBack)
        {
            LoadGrid();
            dbc.BindCountry(ddl_company_country);
            ViewGrid();
            //  dbc.BindState(ddl_company_state);
            if (ddl_company_country.SelectedIndex > 0)
            {
                dbc.BindState1(ddl_company_state, int.Parse(ddl_company_country.SelectedValue));
            }
            if (ddl_company_state.SelectedIndex > 0)
            {
                dbc.BindDistrict(ddl_company_district, int.Parse(ddl_company_state.SelectedValue.ToString()));
            }
            Divcreate.Visible = false;
            DivView.Visible   = true;
            //lblhead.Text = "View Company";


            lbl_RecordAddedOn.Text = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt");
            lbl_RecordAddedBy.Text = Empname;
        }
    }
        private void Create_Branch_Load(object sender, EventArgs e)
        {
            Branch_id = 0;
            dbc.BindCompany(ddl_Company);
            pnlSideTree.Visible = true;
            AddParent();
            lbl_RecordAddedBy.Text = username;
            lbl_RecordAddedOn.Text = DateTime.Now.ToString();
            //  ddl_Company.SelectedIndex = 0;
            ddl_Company.Select();

            dbc.BindState1(ddl_Branch_state, int.Parse(ddl_Branch_country.SelectedValue.ToString()));

            bindDistrict();
        }
 public Create_Company(int user_id, string Username)
 {
     InitializeComponent();
     username = Username;
     dbc.BindCountry(ddl_company_country);
     if (ddl_company_country.SelectedIndex > 0)
     {
         dbc.BindState1(ddl_company_state, int.Parse(ddl_company_country.SelectedValue.ToString()));
     }
     if (ddl_company_state.SelectedIndex > 0)
     {
         dbc.BindDistrict(ddl_company_district, int.Parse(ddl_company_state.SelectedValue.ToString()));
     }
     userid = user_id;
     //txt_companyname.MinimumSize = new Size(32, 0);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
        else
        {
            userid  = int.Parse(Session["userid"].ToString());
            Empname = Session["Empname"].ToString();
        }

        if (!IsPostBack)
        {
            dbc.BindCompany(ddl_Company);
            dbc.BindBranch(ddl_branchname, int.Parse(ddl_Company.SelectedValue.ToString()));
            // GetMaximumClientNumber();
            DivView.Visible   = true;
            Divcreate.Visible = false;
            lblhead.Text      = "View Clients";
            GridviewbindClients();
            lbl_Record_Addedby.Text   = Empname.ToString();
            lbl_Record_AddedDate.Text = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt");
            dbc.BindCountry(Ddl_Client_Country);
            dbc.BindCompany(ddl_Company);

            //  dbc.BindState(ddl_company_state);
            if (Ddl_Client_Country.SelectedIndex > 0)
            {
                dbc.BindState1(Ddl_Client_State, int.Parse(Ddl_Client_Country.SelectedValue));
            }
            if (Ddl_Client_State.SelectedIndex > 0)
            {
                dbc.BindDistrict(ddl_Client_district, int.Parse(Ddl_Client_State.SelectedValue.ToString()));
            }
        }
    }