Пример #1
0
        protected void sandbox_invoke_add_similar_onclick(p5.Container container, EventArgs e)
        {
            // removing one controls
            container.RemoveControlPersistentAt(0);  // sandbox_invoke_remove_many_2

            // adding another control with same ID
            var lit1 = container.CreatePersistentControl <p5.Literal> ("sandbox_invoke_add_similar_child", 0);

            lit1.Element    = "strong";
            lit1.innerValue = "howdy";
        }
Пример #2
0
        protected void replace_random_onclick(p5.Void btn, EventArgs e)
        {
            CurrentEdit = null;
            if (List.Controls.Count == 0)
            {
                Txt["value"] = "Nothing to replace!!";
            }
            else
            {
                var which = new Random().Next(0, List.Controls.Count);
                List.RemoveControlPersistentAt(which);

                var widget = List.CreatePersistentControl <p5.Literal> ("x" + (_next++), which);
                widget.Element    = "li";
                widget["onclick"] = "item_onclick";
                widget.innerValue = Txt["value"];
            }
        }
Пример #3
0
        protected void sandbox_invoke_remove_many_onclick(p5.Container container, EventArgs e)
        {
            // removing three controls
            container.RemoveControlPersistentAt(1);                                                           // sandbox_invoke_remove_many_2
            ((p5.Container)container.Controls [1]).RemoveControlPersistentAt(2);                              // sandbox_invoke_remove_many_6
            ((p5.Container)((p5.Container)container.Controls [1]).Controls [1]).RemoveControlPersistentAt(1); // sandbox_invoke_remove_many_9

            // creating two new controls

            // parent is sandbox_invoke_remove_many
            var lit1 = container.CreatePersistentControl <p5.Literal> (null, 0);

            lit1.Element    = "strong";
            lit1.innerValue = "howdy";

            // parent is sandbox_invoke_remove_many_5
            var lit2 = ((p5.Container)((p5.Container)container.Controls [2]).Controls [1]).CreatePersistentControl <p5.Literal> ();

            lit2.Element    = "em";
            lit2.innerValue = "world";
        }