Dynamic controls using ASP.NET

  • Thread starter Thread starter itsme
  • Start date Start date
I

itsme

Hello Guys,

I am trying to add server controls dynamically using XSL.
I found an interesting article[Courtesy: Wrox Team] which
shows how to add them dynamically onto the page.

But in the article it says that one has to create an
XPathDocument using an XML file. My problem is I have a
DataSet which is actually converted to an XmlDocument, now
in this case how can I use the XmlDocument instead of Xml
file(as showed in the article) for the XPathDocument
instantiation to add the controls onto the page?

Your help is appreciated!

Thanks
 
Hi,

XPathDocument constractor recieve TextReader as parameter and you can
create one from dataset GetXml method.

TextReader tr = new TextReader(MyDataSet.GetXml());
XPathDocument xPathDoc = new XPathDocument (tr);

But I can't see why you are using dataset when you can use datareader
that is more efficient. For sample code refer:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
tml/frlrfsystemxmlxpathxpathdocumentclassctortopic.asp

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Back
Top