Wednesday, December 30, 2009

Render Codein aspx page using XML and XSL

Once you have created your template (Xml,Xslt) then you have to render on the page for render the code in your page you have to create one of the place holder in your page and place form load code in you load section.

You must need to modify your xml,xsl file name.

protected void Page_Load(object sender, EventArgs e)
XslCompiledTransform proc = new XslCompiledTransform();
StringWriter writer = new StringWriter();
proc.Transform(XmlReader.Create(Server.MapPath("form.xml")), null, writer);

Some time controls doesn't placed in the pages using xslt so you have to apply the above format or lines or code other wise you can directly render the code using this control