protected void dgCitys_SelectedIndexChanged(object sender, EventArgs e) { int iCityID = Convert.ToInt32(dgCitys.DataKeys[dgCitys.SelectedIndex].ToString()); hfId.Value = iCityID.ToString(); //SessionHandler"CityID"] = iCityID; CityMaster oCityMaster = new CityMaster(); CityDTO[] oCityData = oCityMaster.GetData(iCityID); if (oCityData.Length > 0) { txtCityCode.Text = oCityData[0].CityCode.ToString(); txtCityName.Text = oCityData[0].CityName.ToString(); } oCityMaster = null; oCityData = null; //btnAddNew.Enabled = false; //btnCancel.Enabled = true; btnCancel.Visible = true; btnDelete.Enabled = true; btnEdit.Text = "Update"; //btnSave.Enabled = false; lblStatus.Text = ""; }
private void RefreshGrid() { CityMaster oCityMaster = new CityMaster(); CityDTO[] oCityData = oCityMaster.GetData(); if (oCityData != null) { if (oCityData.Length > 0) { dgCitys.DataSource = oCityData; dgCitys.DataBind(); } } else { dgCitys.DataSource = null; dgCitys.DataBind(); } txtCityCode.Text = ""; txtCityName.Text = ""; oCityData = null; oCityMaster = null; }