protected void lbuRefresh_Click(object sender, EventArgs e)
 {
     ClearData();
     ClassDistrict d = new ClassDistrict();
     DataTable dt = d.GetDistrict("", "", "", "", "", "");
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
 void BindData()
 {
     ClassDistrict d = new ClassDistrict();
     DataTable dt = d.GetDistrict("", "", "", "", "", "");
     GridView1.DataSource = dt;
     GridView1.DataBind();
     SetViewState(dt);
 }
 void BindData1()
 {
     if (!string.IsNullOrEmpty(txtSearchDistrictTH.Text))
     {
         ClassDistrict a1 = new ClassDistrict();
         DataTable dt1 = a1.GetDistrict(txtSearchDistrictTH.Text, "", "", "", "", "");
         GridView1.DataSource = dt1;
         GridView1.DataBind();
         SetViewState(dt1);
     }
     if (!string.IsNullOrEmpty(txtSearchDistrictEN.Text))
     {
         ClassDistrict a2 = new ClassDistrict();
         DataTable dt2 = a2.GetDistrict("", txtSearchDistrictEN.Text, "", "", "", "");
         GridView1.DataSource = dt2;
         GridView1.DataBind();
         SetViewState(dt2);
     }
     if (ddlSearchAmphur.SelectedIndex != 0)
     {
         ClassDistrict a3 = new ClassDistrict();
         DataTable dt3 = a3.GetDistrict("", "", ddlSearchAmphur.SelectedValue, "", "", "");
         GridView1.DataSource = dt3;
         GridView1.DataBind();
         SetViewState(dt3);
     }
     if (ddlSearchProvince.SelectedIndex != 0)
     {
         ClassDistrict a4 = new ClassDistrict();
         DataTable dt4 = a4.GetDistrict("", "", "", ddlSearchProvince.SelectedValue, "", "");
         GridView1.DataSource = dt4;
         GridView1.DataBind();
         SetViewState(dt4);
     }
     if (!string.IsNullOrEmpty(txtSearchPostCode.Text))
     {
         ClassDistrict a5 = new ClassDistrict();
         DataTable dt5 = a5.GetDistrict("", "", "", "", txtSearchPostCode.Text, "");
         GridView1.DataSource = dt5;
         GridView1.DataBind();
         SetViewState(dt5);
     }
     if (!string.IsNullOrEmpty(txtSearchNote.Text))
     {
         ClassDistrict a6 = new ClassDistrict();
         DataTable dt6 = a6.GetDistrict("", "", "", "", "", txtSearchNote.Text);
         GridView1.DataSource = dt6;
         GridView1.DataBind();
         SetViewState(dt6);
     }
 }
        protected void lbuSearch_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSearchDistrictTH.Text) && string.IsNullOrEmpty(txtSearchDistrictEN.Text) && ddlSearchAmphur.SelectedIndex == 0 && ddlSearchProvince.SelectedIndex == 0 && string.IsNullOrEmpty(txtSearchPostCode.Text) && string.IsNullOrEmpty(txtSearchNote.Text))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true);

                return;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtSearchDistrictTH.Text))
                {
                    ClassDistrict a1 = new ClassDistrict();
                    DataTable dt1 = a1.GetDistrict(txtSearchDistrictTH.Text, "", "", "", "", "");
                    GridView1.DataSource = dt1;
                    GridView1.DataBind();
                    SetViewState(dt1);
                }
                if (!string.IsNullOrEmpty(txtSearchDistrictEN.Text))
                {
                    ClassDistrict a2 = new ClassDistrict();
                    DataTable dt2 = a2.GetDistrict("", txtSearchDistrictEN.Text, "", "", "", "");
                    GridView1.DataSource = dt2;
                    GridView1.DataBind();
                    SetViewState(dt2);
                }
                if (ddlSearchAmphur.SelectedIndex != 0)
                {
                    ClassDistrict a3 = new ClassDistrict();
                    DataTable dt3 = a3.GetDistrict("", "", ddlSearchAmphur.SelectedValue, "", "", "");
                    GridView1.DataSource = dt3;
                    GridView1.DataBind();
                    SetViewState(dt3);
                }
                if (ddlSearchProvince.SelectedIndex != 0)
                {
                    ClassDistrict a4 = new ClassDistrict();
                    DataTable dt4 = a4.GetDistrict("", "", "", ddlSearchProvince.SelectedValue, "", "");
                    GridView1.DataSource = dt4;
                    GridView1.DataBind();
                    SetViewState(dt4);
                }
                if (!string.IsNullOrEmpty(txtSearchPostCode.Text))
                {
                    ClassDistrict a5 = new ClassDistrict();
                    DataTable dt5 = a5.GetDistrict("", "", "", "", txtSearchPostCode.Text, "");
                    GridView1.DataSource = dt5;
                    GridView1.DataBind();
                    SetViewState(dt5);
                }
                if (!string.IsNullOrEmpty(txtSearchNote.Text))
                {
                    ClassDistrict a6 = new ClassDistrict();
                    DataTable dt6 = a6.GetDistrict("", "", "", "", "", txtSearchNote.Text);
                    GridView1.DataSource = dt6;
                    GridView1.DataBind();
                    SetViewState(dt6);
                }
            }
        }