Subtext.Web.UI.Controls.PostComment.OnLoad C# (CSharp) Method

OnLoad() protected method

Handles the OnLoad event. Attempts to prepopulate comment fields based on the user's cookie.
protected OnLoad ( EventArgs e ) : void
e System.EventArgs E.
return void
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad (e);

            //TODO: Make this configurable.
            tbTitle.MaxLength = 128;
            tbEmail.MaxLength = 128;
            tbName.MaxLength = 32;
            tbUrl.MaxLength = 256;
            tbComment.MaxLength = 4000;
            SetValidationGroup();

            if(!IsPostBack)
            {
                if (this.Entry == null)
                {
                    //Somebody probably is messing with the url.
                    Response.Redirect("~/SystemMessages/FileNotFound.aspx", true);
                    return;
                }

                ResetCommentFields();

                if(Config.CurrentBlog.CoCommentsEnabled)
                {
                    if(coComment == null)
                    {
                        coComment = new SubtextCoComment();
                        PlaceHolder coCommentPlaceHolder = Page.FindControl("coCommentPlaceholder") as PlaceHolder;
                        if(coCommentPlaceHolder != null)
                        {
                            coCommentPlaceHolder.Controls.Add(coComment);
                        }
                    }
                    coComment.PostTitle = entry.Title;
                    coComment.PostUrl = entry.Url;
                    if(entry.Url.StartsWith("/"))
                    {
                        coComment.PostUrl = "http://" + Config.CurrentBlog.Host + coComment.PostUrl;
                    }
                }
            }

            this.DataBind();
        }