protected void DDL_Tah_SelectedIndexChanged(object sender, EventArgs e) { try { if (DDL_Tah.SelectedItem.Text != "--Select--") { SqlObj = new SqlString(ComObj); string strsql = " select * from LR_VillageMaster vm,DistrictMaster dm,LR_TehsilMaster tm where dm.DistNo_LRMP=vm.Distno and tm.Tehsilno=vm.Tehsilno and tm.Distno=dm.DistNo_LRMP and dm.DistrictCode='" + DDL_Dist.SelectedValue + "' and vm.Tehsilno='" + DDL_Tah.SelectedValue + "'"; DataSet ds = SqlObj.selectAny(strsql); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { DDL_Village.DataSource = ds.Tables[0]; DDL_Village.DataTextField = "Villagename"; DDL_Village.DataValueField = "Villageno"; DDL_Village.DataBind(); DDL_Village.Items.Insert(0, "--Select--"); } } } } catch (Exception ex) { Page.RegisterClientScriptBlock("mymsg2", "<script language=javascript> alert('" + ex.Message + "'); </script> "); } }
private void GetVillage() { try { DDL_Village.DataSource = null; DDL_Village.DataBind(); SqlObj = new SqlString(ComObj); string strsql = " select * from LR_VillageMaster vm,DistrictMaster dm,LR_TehsilMaster tm where dm.DistNo_LRMP=vm.Distno and tm.Tehsilno=vm.Tehsilno and tm.Distno=dm.DistNo_LRMP and dm.DistNo_LRMP='" + DDL_Dist.SelectedValue + "' and vm.Tehsilno='" + DDL_Tah.SelectedValue + "' order by vm.Villagename "; DataSet ds = SqlObj.selectAny(strsql); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { DDL_Village.DataSource = ds.Tables[0]; DDL_Village.DataTextField = "Villagename"; DDL_Village.DataValueField = "Villageno"; DDL_Village.DataBind(); DDL_Village.Items.Insert(0, "--चुनिये--"); } } } catch (Exception ex) { Page.RegisterClientScriptBlock("mymsg2", "<script language=javascript> alert('" + ex.Message + "'); </script> "); } }
private void GetVillage() { SqlObj = new SqlString(ComObj); string strsql = " select * from LR_VillageMaster vm,DistrictMaster dm,LR_TehsilMaster tm where dm.DistNo_LRMP=vm.Distno and tm.Tehsilno=vm.Tehsilno and tm.Distno=dm.DistNo_LRMP and dm.DistrictCode='" + DDL_Dist.SelectedValue + "' and vm.Tehsilno='" + DDL_Tah.SelectedValue + "'"; DataSet ds = SqlObj.selectAny(strsql); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { DDL_Village.DataSource = ds.Tables[0]; DDL_Village.DataTextField = "Villagename"; DDL_Village.DataValueField = "Villageno"; DDL_Village.DataBind(); DDL_Village.Items.Insert(0, "--Select--"); } } }