ActivEarth.Groups.EditGroup.Page_Load C# (CSharp) 메소드

Page_Load() 보호된 메소드

Populates the text fields on the page with the Group's current information when the page loads. Redirects if the User is not logged in, the ID of the Group was not provided, or if the User is not the Owner of the Group.
protected Page_Load ( object sender, EventArgs e ) : void
sender object
e EventArgs
리턴 void
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Session["userDetails"] == null)
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            else if (Request.QueryString["ID"] == null)
            {
                Response.Redirect("~/Groups/Groups.aspx");
            }
            else
            {
                int groupID = Convert.ToInt32(Request.QueryString["ID"]);
                Group currentGroup = GroupDAO.GetGroupFromGroupId(groupID);

                if (currentGroup == null || currentGroup.Owner.UserID != ((User)Session["userDetails"]).UserID)
                {
                    Response.Redirect("~/Groups/Groups.aspx");
                }

                if (txbGroupName.Text == "")
                {
                    txbGroupName.Text = currentGroup.Name;
                }
                if (txbDescription.Text == "")
                {
                    txbDescription.Text = currentGroup.Description;
                }
                if (lblAllHashTags.Text == "")
                {
                    lblAllHashTags.Text = "[]";
                    foreach (string tag in currentGroup.HashTags)
                    {
                        txbHashTag.Text = tag;
                        AddHashTag(null, null);
                    }
                }

            }
        }