Question

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?

Was it helpful?

Solution 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 ;)

OTHER TIPS

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
        });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top