private void LoadLevelsFromDatabase() { try { Result oResult = new Result(); LevelBO oLevelBO = new LevelBO(); List<Level> oListLevel = new List<Level>(); oResult = oLevelBO.LoadAllLevels(); if (oResult.ResultIsSuccess) { oListLevel = (List<Level>)oResult.ResultObject; drdnSelectQuestionLevel.Items.Clear(); drdnSelectQuestionLevel.Items.Add(new ListItem("[Select One]", "[Select One]")); foreach (Level oLevelInList in oListLevel) { drdnSelectQuestionLevel.Items.Add(new ListItem(oLevelInList.LevelName, oLevelInList.LevelID.ToString())); } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = oResult.ResultMessage; } } catch (Exception oEx) { } }
private void LoadLevelsToDataList() { try { Result oResult = new Result(); LevelBO oLevelBO = new LevelBO(); oResult = oLevelBO.LoadAllLevels(); listLevels.Items.Clear(); if (oResult.ResultIsSuccess) { oListForDataList = (List<Level>)oResult.ResultObject; this.ViewState.Add(SessionManager.csStoreGridView, oListForDataList); //listLevels.DataSource = oListForDataList; //listLevels.DataBind(); foreach (Level oLevelInList in oListForDataList) { listLevels.Items.Add(new ListItem(oLevelInList.LevelName,oLevelInList.LevelName)); } } else { lbl_error.ForeColor = Color.Red; lbl_error.Text = oResult.ResultMessage; } } catch (Exception oEx) { } }