public static RadioButtonList BindMaritaStatus(RadioButtonList rbList, string texto, string valor) { try { if (SPContext.Current != null) { using (Microsoft.SharePoint.SPWeb web = SPContext.Current.Web) { BLL.MaritalStateBLL bll = new CAFAM.WebPortal.BLL.MaritalStateBLL(web); DataSet ds = bll.GetMaritalStateList(); BindList(rbList, ds, texto, valor); } } else { using (SPSite site = new SPSite(SP_SITE)) { using (Microsoft.SharePoint.SPWeb web = site.OpenWeb()) { BLL.MaritalStateBLL bll = new CAFAM.WebPortal.BLL.MaritalStateBLL(web); DataSet ds = bll.GetMaritalStateList(); BindList(rbList, ds, texto, valor); } } } } catch (Exception ex) { throw ex; } return rbList; }
protected void BindData() { try { ListItem blankListItem = new ListItem(); SPWeb web = SPContext.Current.Web; BLL.MaritalStateBLL maritalStateBLL = new CAFAM.WebPortal.BLL.MaritalStateBLL(web); rdlMaritalState.DataSource = maritalStateBLL.GetMaritalStateList(); rdlMaritalState.DataTextField = "Title"; rdlMaritalState.DataValueField = "Title"; rdlMaritalState.DataBind(); rdlMaritalState.Items[0].Selected = true; BLL.OccupationBLL occupationBLL = new CAFAM.WebPortal.BLL.OccupationBLL(web); ddlOccupation.DataSource = occupationBLL.GetOccupationList(); ddlOccupation.DataTextField = "Title"; ddlOccupation.DataValueField = "Title"; ddlOccupation.DataBind(); BLL.CompensationFundBLL compensationFundBLL = new CAFAM.WebPortal.BLL.CompensationFundBLL(web); ddlCompensationFund.DataSource = compensationFundBLL.GetCompensationFundList(); ddlCompensationFund.DataTextField = "Title"; ddlCompensationFund.DataValueField = "Title"; ddlCompensationFund.DataBind(); ddlCompensationFund.Items.Insert(0, new ListItem("Ninguno", "")); BLL.EPSBLL ePSBLL = new CAFAM.WebPortal.BLL.EPSBLL(web); ddlEPS.DataSource = ePSBLL.GetEPSList(); ddlEPS.DataTextField = "Title"; ddlEPS.DataValueField = "Title"; ddlEPS.DataBind(); ddlEPS.Items.Insert(0, new ListItem("Ninguno", "")); BLL.IncomeLevelBLL incomeLevelBLL = new CAFAM.WebPortal.BLL.IncomeLevelBLL(web); ddlIncomeLevel.DataSource = incomeLevelBLL.GetIncomeLevelList(); ddlIncomeLevel.DataTextField = "Title"; ddlIncomeLevel.DataValueField = "Value"; ddlIncomeLevel.DataBind(); ddlIncomeLevel.Items.Insert(0, blankListItem); BLL.SecurityQuestionBLL securityQuestionBLL = new CAFAM.WebPortal.BLL.SecurityQuestionBLL(web); ddlSecurityQuestion.DataSource = securityQuestionBLL.GetSecurityQuestionList(); ddlSecurityQuestion.DataTextField = "Title"; ddlSecurityQuestion.DataValueField = "Title"; ddlSecurityQuestion.DataBind(); ddlSecurityQuestion.Items.Insert(ddlSecurityQuestion.Items.Count, new ListItem("Otra pregunta", "")); BLL.TopicOfInterestBLL topicOfInterestBLL = new BLL.TopicOfInterestBLL(web); chkListTopicOfInterest.DataSource = topicOfInterestBLL.GetTopicOfInterestList(); chkListTopicOfInterest.DataTextField = "Title"; chkListTopicOfInterest.DataValueField = "Title"; chkListTopicOfInterest.DataBind(); } catch (Exception ex) { throw ex; } }