Example #1
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            this.Controls.Clear();

            ///Setup the field controls
            int count = 0;

            foreach (EditableField field in this.EditableForm.Fields)
            {
                ///wrap each field in a DIV
                this.Controls.Add(new LiteralControl("<div>"));

                EditableFileFormField fieldControl = new EditableFileFormField();
                fieldControl.ID = "Field" + count++;
                this.Controls.Add(fieldControl);
                fieldControl.EditableField     = field;
                fieldControl.FormValueChanged += new EventHandler(FieldFormValueChanged);

                //end the div
                this.Controls.Add(new LiteralControl("</div>"));
            }


            ///put some space in between
            this.Controls.Add(new LiteralControl("<br />"));

            ///break between the fields and buttons
            this.Controls.Add(new LiteralControl("<div>"));

            //save and cancel buttons
            Button saveButton = new Button();

            saveButton.ID      = "SaveButton";
            saveButton.Text    = "Save Changes";
            saveButton.ToolTip = "Save your changes";
            saveButton.Attributes.Add("onclick", "return confirm('Are you sure you want to save your changes?')");
            saveButton.Click += new EventHandler(HandleSaveButtonClick);
            this.Controls.Add(saveButton);

            Button cancelButton = new Button();

            cancelButton.ID   = "CancelButton";
            cancelButton.Text = "Cancel Changes";
            cancelButton.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel your changes?')");
            cancelButton.ToolTip = "Cancel and changes you made since the last save";
            cancelButton.Click  += new EventHandler(HandleCancelButtonClick);
            this.Controls.Add(cancelButton);

            Button deleteButton = new Button();

            deleteButton.ID      = "DeleteButton";
            deleteButton.Text    = "Delete File";
            deleteButton.ToolTip = "Delete this file";
            deleteButton.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this file?')");
            deleteButton.Click += new EventHandler(HandleDeleteButtonClicked);
            this.Controls.Add(deleteButton);

            //end the div
            this.Controls.Add(new LiteralControl("</div>"));

            base.CreateChildControls();
        }
Example #2
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            this.Controls.Clear();

            ///Setup the field controls
            int count = 0;
            foreach (EditableField field in this.EditableForm.Fields)
            {
                ///wrap each field in a DIV
                this.Controls.Add(new LiteralControl("<div>"));

                EditableFileFormField fieldControl = new EditableFileFormField();
                fieldControl.ID = "Field" + count++;
                this.Controls.Add(fieldControl);
                fieldControl.EditableField = field;
                fieldControl.FormValueChanged += new EventHandler(FieldFormValueChanged);
         
                //end the div
                this.Controls.Add(new LiteralControl("</div>"));
            }


            ///put some space in between
            this.Controls.Add(new LiteralControl("<br />"));

            ///break between the fields and buttons
            this.Controls.Add(new LiteralControl("<div>"));

            //save and cancel buttons
            Button saveButton = new Button();
            saveButton.ID = "SaveButton";
            saveButton.Text = "Save Changes";
            saveButton.ToolTip = "Save your changes";
            saveButton.Attributes.Add("onclick", "return confirm('Are you sure you want to save your changes?')");
            saveButton.Click += new EventHandler(HandleSaveButtonClick);
            this.Controls.Add(saveButton);

            Button cancelButton = new Button();
            cancelButton.ID = "CancelButton";
            cancelButton.Text = "Cancel Changes";
            cancelButton.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel your changes?')");
            cancelButton.ToolTip = "Cancel and changes you made since the last save";
            cancelButton.Click += new EventHandler(HandleCancelButtonClick);
            this.Controls.Add(cancelButton);

            Button deleteButton = new Button();
            deleteButton.ID = "DeleteButton";
            deleteButton.Text = "Delete File";
            deleteButton.ToolTip = "Delete this file";
            deleteButton.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this file?')");
            deleteButton.Click += new EventHandler(HandleDeleteButtonClicked);
            this.Controls.Add(deleteButton);

            //end the div
            this.Controls.Add(new LiteralControl("</div>"));

            base.CreateChildControls();
        }