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();
proc.Load(Server.MapPath("XSLTFile.xsl"));
StringWriter writer = new StringWriter();
proc.Transform(XmlReader.Create(Server.MapPath("form.xml")), null, writer);
P1.Controls.Add(Page.ParseControl(writer.ToString()));
}

Some time Asp.net 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

1 comment:

  1. Codeine used as a rescue medication I was started on tylenol #3 while pregnant for pain control with migraines. It worked well, but after 3 years now it is starting not to work as well. Only side effect for me was tiredness.

    ReplyDelete