private void fillStateCode() { DropDownList ddlState = (DropDownList)frmCityMaster.FindControl("ddlState"); TextBox txtStateCode = (TextBox)frmCityMaster.FindControl("txtStateCode"); var result = _objMasterData.GetStateNameAndCode(new MDMSVC.DC_State_Master_DDL_RQ { State_ID = Convert.ToString(ddlState.SelectedValue) }); if (result != null) { txtStateCode.Text = Convert.ToString(result.StateCode); } }