What if…

What if you we’re able to construct complex HTML fragments in C# with the same ease and readability as you are, using jQuery?

Stuff like…


var list = new cQuery
(
    tag: "ul",
    id: "tags",
    controls: new []
    {
        new cQuery(tag: "li", text: "C#"),
        new cQuery(tag: "li", text: "JavaScript"),

        new cQuery(tag: "li", text: "Markup languages").Append
        (
            new cQuery("ul").Append(new []
            {
                new cQuery("li", text: "XHTML"),
                new cQuery("li", text: "HTML 4"),
                new cQuery("li", text: "HTML 5")
            })
        ),

        new cQuery(tag: "li", text: "CSS")
    }
);

list.Wrap
(
    new cQuery("div").AddClass("horizontal").Append
    (
        new cQuery(new LinkButton { ID = "hidelist", Text = "Hide" }).AddClass("small")
    )
);

PlaceHolder.Controls.Add(list);

I will be releasing my cQuery class shortly. Stay tuned.

Leave a comment