This is a migrated thread and some comments may be shown as answers.

[Solved] Can't find grids in a postback - getting all controls on a page

3 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 19 Aug 2009, 02:01 PM
Hi,

I have a postback function that loads and binds several grids and I want to get the entire page, including those grids, and render to html to send out as an email.

I am doing this (VB)

for i = 0 to Page.controls.Count -1

Me.controls(i).RenderControl(htmlTextwriter) ... skiping syntax to get to the point here

next

but in this loop, which exists in a button onClick event handler, the grids are not present - I see literal controls, etc. but no grids at all. What am I missing here? Thanks.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 19 Aug 2009, 02:05 PM
Hello,

Most probably these grids are child controls of these controls - you will need recursion probably.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Karl Wilkens
Top achievements
Rank 1
answered on 19 Aug 2009, 02:49 PM
Thanks. My stupid. Now I have all the grids, and want to render them out as HTML and send as an email. Of course, without the CSS, it looks awful. How can i incorporate a reference to the CSS (Web20 in this case) in a way that can be sent as an html Email?
0
Sebastian
Telerik team
answered on 24 Aug 2009, 11:31 AM
Hello Karl,

Extracting the styles from the grid elements and injecting them in the html of the email would be a cumbersome process and may not work properly with all possible grid configurations.

Instead you may consider exporting the grid to pdf (for example) in order to format its table in a custom manner and then attach the exported file to an email. Review the forum thread linked below for more details on this approach:

http://www.telerik.com/community/forums/aspnet-ajax/grid/need-to-attach-the-pdf-and-send-email.aspx

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Karl Wilkens
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or