public void clear() { txtAddress.Text = ""; txtContactNo.Text = ""; txtEmail.Text = ""; txtEmailid.Text = ""; txtFaxNo.Text = ""; txtPinCode.Text = ""; txtUniversityName.Text = ""; DDL_Country.ClearSelection(); DDL_State.ClearSelection(); DDL_City.ClearSelection(); }
// Selected Index Changes #region Selected Index Change protected void lnkBtnUniversityName_Click(object sender, EventArgs e) { try { btnNew.Visible = false; btnSave.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; txtUniversityName.Enabled = true; txtAddress.Enabled = true; txtEmail.Enabled = true; txtPinCode.Enabled = true; txtContactNo.Enabled = true; txtFaxNo.Enabled = true; flpLogo.Enabled = true; DDL_City.Enabled = true; DDL_Country.Enabled = true; DDL_State.Enabled = true; lock (this) { LinkButton lnkBtnId = (LinkButton)sender; GridViewRow grdrow = lnkBtnId.NamingContainer as GridViewRow; ViewState["UniversityId"] = GrdUniversity.DataKeys[grdrow.RowIndex].Values["UniversityId"].ToString(); txtUniversityName.Text = GrdUniversity.DataKeys[grdrow.RowIndex].Values["UniversityName"].ToString(); txtAddress.Text = GrdUniversity.DataKeys[grdrow.RowIndex].Values["Address"].ToString(); //LoadCountryDropDown(); // DDL_Country.SelectedValue = GrdUniversity.DataKeys[grdrow.RowIndex].Values["Country"].ToString(); //LoadStateDropDown(DDL_Country.SelectedValue); //LoadCityDropDown(DDL_State.SelectedValue); // DDL_City.SelectedValue = GrdUniversity.DataKeys[grdrow.RowIndex].Values["City"].ToString(); //DDL_Country.SelectedValue = ds.Tables[0].Rows[0]["Country"].ToString(); //FETCH COUNTRY,STATE,CITY int id = Convert.ToInt32(ViewState["UniversityId"].ToString()); country = db.getDbstatus_Value("select Country from tblUniversity where UniversityId='" + id + "'"); // DDL_Country.Items.FindByValue(CountryId).Selected = true; DDL_Country.ClearSelection(); float abc = db.getDb_Value("select CountryId from Country where County='" + country.ToString() + "' "); DDL_Country.SelectedValue = abc.ToString(); sta = db.getDbstatus_Value("select State from tblUniversity where UniversityId='" + id + "'"); DDL_State.ClearSelection(); Bind_ddlState1(); float pqr = db.getDb_Value("select StateId from countryState where State='" + sta.ToString() + "'"); DDL_State.SelectedValue = pqr.ToString(); ci = db.getDbstatus_Value("select City from tblUniversity where UniversityId='" + id + "'"); DDL_City.ClearSelection(); Bind_ddlCity1(); float xyz = db.getDb_Value("select DistrictId from tblDistrict where District='" + ci.ToString() + "'"); DDL_City.SelectedValue = xyz.ToString(); // DDL_State.Text = state.ToString(); //DDL_State.SelectedValue = state.ToString(); // DDL_State.SelectedValue = GrdUniversity.DataKeys[grdrow.RowIndex].Values["state"].ToString(); txtPinCode.Text = GrdUniversity.DataKeys[grdrow.RowIndex].Values["PinCode"].ToString(); txtEmail.Text = GrdUniversity.DataKeys[grdrow.RowIndex].Values["Email"].ToString(); txtContactNo.Text = GrdUniversity.DataKeys[grdrow.RowIndex].Values["ContactNo1"].ToString(); txtFaxNo.Text = GrdUniversity.DataKeys[grdrow.RowIndex].Values["FaxNo1"].ToString(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }