Dynamic controls using ASP.NET

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
 
N

Natty Gur

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top