/// <summary> /// Binds the list item. /// </summary> public void BindListItem() { BlacklistDB blacklist = new BlacklistDB(); DataSet blist = blacklist.GetBlacklist(this.PortalSettings.PortalID, true, false); repListItem.DataSource = blist; repListItem.DataBind(); }
/// <summary> /// The Page_Load event handler on this User Control is used to /// obtain a DataReader of blacklist information from the Users /// table, and then databind the results to a templated DataList /// server control. It uses the Rainbow.BlacklistDB() /// data component to encapsulate all data functionality. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Page_Load(object sender, System.EventArgs e) { showColumnName = "True" == Settings["BLACKLIST_SHOWCOLUMNNAME"].ToString(); showColumnEmail = "True" == Settings["BLACKLIST_SHOWCOLUMNEMAIL"].ToString(); showColumnSendNewsletter = "True" == Settings["BLACKLIST_SHOWCOLUMNSENDNEWSLETTER"].ToString(); showColumnReason = "True" == Settings["BLACKLIST_SHOWCOLUMNREASON"].ToString(); showColumnDate = "True" == Settings["BLACKLIST_SHOWCOLUMNDATE"].ToString(); showColumnLastSend = "True" == Settings["BLACKLIST_SHOWCOLUMNLASTSEND"].ToString(); showAllUsers = "True" == Settings["BLACKLIST_SHOWALLUSERS"].ToString(); showSubscribersOnly = "True" == Settings["BLACKLIST_SHOWSUBSCRIBERSONLY"].ToString(); if (Page.IsPostBack == false) { sortField = Settings["BLACKLIST_SORTFIELD"].ToString(); sortDirection = "ASC"; if (sortField == "LastSend" || sortField == "Date") { sortDirection = "DESC"; } ViewState["SortField"] = sortField; ViewState["sortDirection"] = sortDirection; } else { sortField = (string)ViewState["SortField"]; sortDirection = (string)ViewState["sortDirection"]; } BlacklistDB blacklist = new BlacklistDB(); DataSet blist = blacklist.GetBlacklist(PortalID, showAllUsers, showSubscribersOnly); myDataView = new DataView(); myDataView = blist.Tables[0].DefaultView; if (!Page.IsPostBack) { myDataView.Sort = sortField + " " + sortDirection; } BindGrid(); }