ActivEarth.Groups.GroupsSearch.Page_Load C# (CSharp) Method

Page_Load() protected method

Prepares the relevant group table to display when the page loads. Redirects the user if they have not signed in or if a search term has not been provided.
protected Page_Load ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userDetails"] == null)
            {
                Response.Redirect("~/Account/Login.aspx");

            }
            else if (Request.QueryString["Term"] == null)
            {
                Response.Redirect("~/Groups/Groups.aspx");
            }
            else
            {
                var userDetails = (User)Session["userDetails"];
                this.userID = userDetails.UserID;

                String[] terms = Request.QueryString["Term"].Split();
                List<String> searchTerms = new List<String>(terms);

                List<Group> results = new List<Group>();

                foreach (String searchTerm in searchTerms)
                {
                    List<Group> searchGroups = GroupDAO.GetAllGroupsByName(searchTerm);
                    List<Group> taggedGroups = GroupDAO.GetAllGroupsByHashTag(searchTerm);
                    ListUnion_NoRepeats(searchGroups, taggedGroups);
                    ListUnion_NoRepeats(results, searchGroups);
                }

                Color[] backColors = { Color.FromArgb(34, 139, 34), Color.White };
                Color[] textColors = { Color.White, Color.Black };

                SearchGroupsDisplayTable1.PopulateGroupsTable(results, backColors, textColors);

            }
        }