UserControl output into an XmlNode

    Date: 08/15/05 (C Sharp)    Keywords: cms, html, xml

    Very cheeky of me, having only just joined this community, but may I post an awkward question?

    In a CMS-like environment, I have a list of items that is generated on the serverside using an XmlDocument to throw together XHTML tags (mainly because it's substantially easier than using a Repeater, but the why is a moot point as the project doesn't have the budget for me to change that).

    Now I have a requirement to add a new list item at the end of each list that is an "Add new item" form. It's very easy for me to write a UserControl to handle this form action, but would be relatively difficult to write this form bit as XmlElements to add into the exsiting XmlNode tree.

    Is there a way for me to get the output of the server control as an XmlNode and squish that into my XmlNode tree?

    Effectively, I want to take my existing code and making it look something like this:

         bool isInAuthoringMode;
         XmlDocument xml;
         XmlElement div;
     5   // ...
         if (isInAuthoringMode || (this.Assets != null &&
             this.Assets.Count > 0)
    10      XmlElement ul = xml.CreateElement("ul");
            ul.Attributes["class"].Value = "file-list";
            foreach (Asset a in this.Assets)
    15         ul.AppendChild(a.ToXml(xml));
            if (isInAuthoringMode)
               ul.AppendChild(new EditControl().ToXml(xml));
    20      div.AppendChild(ul);

    Line 18 in this code block is what I'd really like to be able to do, but I know that would be being very optimistic.

    Is there any obvious way of getting "the HTML this control would generate here" out of it, even if I have to write a new method into it somewhere?

    The behavior I seek is roughly the same as if I had a Repeater like this:


    But I can't use a Repeater (for reasons too tedious to detail here).

    Any ideas gratefully received. Thanks!

    Cross-posted to '[info]'owenblacker, '[info]'csharp and '[info]'ms_dot_net. Sorry :o)


« hmm || Re: UserControl output into... »

antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home