Pregunta

I have "export" button, onclick event creates markup of some current asp.net page's controls (via RenderControl), then I want to wrap this markup into valid html body and give a user as an ordinal html file.

The question is how to accurately and easily gather all css, referenced on current page (it may include axd-resources, link tags and inline styles) and attach this inline to my markup?

¿Fue útil?

Solución 2

What required is to override Render handler for the Page and save its markup into property. Then in UnLoad handler of control to use this property for extracting CSS from it and construct result page markup using RenderControl method without any problem ;)

Otros consejos

You can add cssClass property in your code behind

     //SlideShowDiv is the id of th div in which you add your sever control
    SlideShowDiv.Controls.Add(new System.Web.UI.WebControls.Image()
        {   CssClass ="YourCssClass",
            ImageUrl = slideShowImages[i].ImageUrl,
            ToolTip = slideShowImages[i].ToolTip,
            Width = slideShowImages[i].Width,
            Height = slideShowImages[i].height,
            ImageAlign = ImageAlign.AbsMiddle
        });
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top