Email or PDF Rendered a GridView control

Posted by: dssonthenet on 10 September 2017, 11:35 am EST

  • Posted 10 September 2017, 11:35 am EST

    Hello All,


    I am working on an ASP.Net application. Currently using ComponentOne GridViews in them.


    It renders fine and everything is cool.


    Now, the functionality needed is as follows.
    We have an Email button and PDF button on the page which on clicking, should be able to Email /PDF the Gridview control.


    For Email, what I am planning to do is as follows:
    Get the Rendered HTML from the RenderControl() method and then set this string as the body of the HTML mail I am sending.
    For PDF, I am planning to do the same, get the rendered HTML and pass it to the PDF component and call the DrawHTML().


    But, what I am wondering is, what will happen to the styles that are required to style the grid (color, skin styles etc..)?


    Has anyone come across this situation before OR has any idea to solve this issue?


    Please let me know guys.


    thanks,


    Shan

  • Replied 10 September 2017, 11:35 am EST

    Do you use ComponentOne PDF for .NET for PDF generation? If so, please ask about the details of PDF generation on that control support forum here helpcentral.componentone.com/.../12.aspx

  • Replied 10 September 2017, 11:35 am EST

    >> But, what I am wondering is, what will happen to the styles that are required to style the grid (color, skin styles etc..)?


    Some general thoughts:


    RenderControl() returns an HTML markup of the control generated by server. Some features of C1GridView require client-side initialization (scrolling, for example). So you should not be using any features that require java script initialization.


    The same for the styles, if grid is designed using inline css (RowStyle, HeaderStyle poperties, etc) then there should be no problems since such styling comes as style attributes withing HTML code. If grid is designed using VisualStyle, then resulting HTML will have only the names of css classes, but not the classes description.

  • Replied 10 September 2017, 11:35 am EST

    If that is the case, then is there any other possibility to get the page printed in a PDF format?


    We will be having ComponentOne Gridview's, Charts etc.. on a page. And we need to create a PDF dynamically of that page and send it to the user.


    Any otherways you can suggest please?

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels