Пример #1
0
        public override void ApplyChanges()
        {
            HomeNews webPart = (HomeNews)this.ParentToolPane.SelectedWebPart;

            if (webPart != null)
            {
                webPart.CommingUpLink = gridCommingUpLink.DataSource as List <CommingUpLink>;
            }
            ViewState["FirstLoad"] = false;
        }
Пример #2
0
        protected override void CreateChildControls()
        {
            HomeNews webPart = (HomeNews)this.WebPartToEdit;

            if (webPart == null)
            {
                return;
            }

            if (ViewState["FirstLoad"] == null || !bool.Parse(ViewState["FirstLoad"].ToString()))
            {
                ViewState["CommingUp"] = webPart.CommingUpLink;
            }

            ViewState["FirstLoad"] = true;

            lblTitle      = new System.Web.UI.WebControls.Label();
            lblTitle.Text = "Comming up link : ";
            Controls.Add(lblTitle);

            literalSpace      = new Literal();
            literalSpace.Text = "<br />Title:&nbsp;";
            Controls.Add(literalSpace);

            txtCommingUpTitle    = new TextBox();
            txtCommingUpTitle.ID = "txtTitle";
            Controls.Add(txtCommingUpTitle);

            literalSpace      = new Literal();
            literalSpace.Text = "<br />Link:&nbsp;";
            Controls.Add(literalSpace);

            txtCommingUpLink    = new TextBox();
            txtCommingUpLink.ID = "txtLink";
            Controls.Add(txtCommingUpLink);

            literalSpace      = new Literal();
            literalSpace.Text = "<br />";
            Controls.Add(literalSpace);

            btnAdd        = new Button();
            btnAdd.ID     = "btnAdd";
            btnAdd.Text   = "Add";
            btnAdd.Click += new EventHandler(btnAdd_Click);
            Controls.Add(btnAdd);

            literalSpace      = new Literal();
            literalSpace.Text = "<br /><br />";
            Controls.Add(literalSpace);

            gridCommingUpLink = new GridView();
            gridCommingUpLink.Style.Add("width", "100%");
            gridCommingUpLink.RowDeleting += new GridViewDeleteEventHandler(gridCommingUpLink_RowDeleting);
            gridCommingUpLink.AutoGenerateDeleteButton = true;

            gridCommingUpLink.DataSource = ViewState["CommingUp"] as List <CommingUpLink>;
            gridCommingUpLink.DataBind();
            Controls.Add(gridCommingUpLink);

            base.CreateChildControls();
        }