protected void sandbox_invoke_insert_child_check_exist_2_onclick(p5.Container container, EventArgs e) { var existing = new List <p5.Literal> (container.ControlsOfType <p5.Literal> ()); if (existing.Count != 2) { throw new ApplicationException("widget disappeared somehow"); } if (existing [0].innerValue != "howdy world") { throw new ApplicationException("widget had wrong innerValue"); } if (existing [1].innerValue != "foo") { throw new ApplicationException("widget had wrong innerValue"); } var literal = container.CreatePersistentControl <p5.Literal> (null, 1); literal.Element = "strong"; literal.innerValue = "howdy world 2"; existing = new List <p5.Literal> (container.ControlsOfType <p5.Literal> ()); if (existing.Count != 3) { throw new ApplicationException("widget disappeared somehow after insertion"); } if (existing [1].innerValue != "howdy world 2") { throw new ApplicationException("widget had wrong innerValue"); } }
protected void love_bomb_onclick(p5.Void btn, EventArgs e) { CurrentEdit = null; var rnd = new Random(); foreach (var idx in List.ControlsOfType <p5.Literal> ()) { if (rnd.Next(0, 3) == 1) { idx.innerValue = "I like turtles!"; idx["class"] = "turtles"; } } }
protected void sandbox_invoke_remove_multiple_onclick(p5.Container container, EventArgs e) { var literals = new List <p5.Literal> (container.ControlsOfType <p5.Literal> ()); container.RemoveControlPersistent(literals [0]); container.RemoveControlPersistent(literals [1]); }
protected void sandbox_invoke_append_remove_onclick(p5.Container container, EventArgs e) { var literals = new List <p5.Literal> (container.ControlsOfType <p5.Literal> ()); container.RemoveControlPersistent(literals [0]); var literal = container.CreatePersistentControl <p5.Literal> (null, 0); literal.Element = "strong"; literal.innerValue = "howdy world"; }