protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (CurrentMember.ScreenName == null) { pnlNoProfile.Visible = true; } else { List <GroupCardModel> groupsList = TelligentService.GetUserGroups(CurrentMember.ScreenName); ddlGroups.DataSource = groupsList; ddlGroups.DataValueField = "Url"; ddlGroups.DataTextField = DictionaryConstants.TitleLabel; ddlGroups.DataBind(); if (ddlGroups.Items.Count != 0) { pnlGroups.Visible = true; divStartADiscussion.Visible = true; hypStartADiscussion.NavigateUrl = ddlGroups.SelectedItem.Value + "/MyDiscussion%20Board"; var commentsList = CommunityHelper.ReadComments(); var commentsByGroup = commentsList.Where(x => x.ParentTitle == ddlGroups.SelectedItem.Text); if (commentsList != null) { rptComments.DataSource = commentsByGroup; rptComments.DataBind(); } } else { pnlNoGroups.Visible = true; } } } }
protected void ddlGroups_SelectedIndexChanged(object sender, EventArgs e) { var commentsList = CommunityHelper.ReadComments(); if (commentsList != null) { rptComments.DataSource = commentsList.Where(x => x.ParentTitle == ddlGroups.SelectedItem.Text); rptComments.DataBind(); } }