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

How to email a web page containing rad controls?

8 Answers 44 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
whit
Top achievements
Rank 1
whit asked on 24 May 2012, 06:10 PM
I am on a team developing an app using mostly the RadGrid and RadComboBox.  We want to provide users with the ability to email pages in the site as an attachement. We of course don't expect or allow any interaction after the page is mailed, just want the html to render what was already displayed, similar to a screen print.   We have done this in the past by using a public image and style folder and adjusting the paths so that when they open the attachment, the code pulls in the images and styles from the public folder on the same site.  We also strip out javascript and anything that could throw an error or cause the display to change. I got pulled in on this project and am brand new to Teleriks controls but the question is can I do the same thing with a page containing these controls?  Upon doing a minimal proof of concept, I did not get very far with this.  Is it possible and if so, how?

8 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 25 May 2012, 10:27 AM
Hello Whit,

I recommend you use Web Archive (MHTML) format. What's neat about this format is that it bundles the web page and all of its references, into a single compact .MHT file. For more information please refer to the following threads:

Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
whit
Top achievements
Rank 1
answered on 01 Jun 2012, 06:31 PM
I coded up a proof of concept that generates and emails a .mht file as an attachement.  Unfortunately when you view the attachment, it still makes references back to the web server it came from and since the site is secured, it does not work.  It does seem to work going against public sites, which won't really solve our problem.  There must a be a way to do this for a Telerik enhanced page.   hmmm....
0
Peter
Telerik team
answered on 04 Jun 2012, 11:01 AM

I am not really sure I understand what exactly the problem is. The .mht file will open just like a .txt or a .docx file. Could you please clarify what you mean? 

Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
whit
Top achievements
Rank 1
answered on 04 Jun 2012, 02:37 PM
I agree that the .mht file should open and render its contents like a .txt file.  I managed to get the .mht file to open and partially render in IE8 and IE9.   The RadGrids seems to render ok but the RadComboBoxes only show the item from the list that was selected, not the actual control.  To try and clarify from my last post is that I believe the .mht file is not encapsulating the entire web page and for whatever reason, when you open the file, there are a couple of references that try to pull css, images, or other data from the URL the .mht was created from.  So, if I am logged into the site (where the .mht file was captured from) and I open the .mht file (in another tab) it works better than if I am not logged in to the site.  Specifically the RadComboBoxes (although still not rendering correctly) will allow me to see the whole selection list).  I have enclosed the errors that we captured when the .mht file is opened in the browser (we get no errors on the actual site).  I Hope this makes sense.  We have to be able to email snapshots of our pages.  If we can get this to work, we will actually disable all controls before emailing the page so no changes can be made by the recipient.
thanks,
whit

Here are the errros we get when opening the .mht file:

SCRIPT5022: ASP.NET Ajax client-side framework failed to load.
C:\Users\skey\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\5V1A5JKX\dashboard.mht, line 54 character 34
SCRIPT5009: 'Type' is undefined
Core.js, line 2 character 15
SCRIPT5009: '$telerik' is undefined
jQuery.js, line 8 character 1
SCRIPT5009: 'Type' is undefined
Ajax.js, line 1 character 1
SCRIPT5009: '$telerik' is undefined
jQueryPlugins.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
ScrollingScripts.js, line 1 character 1
SCRIPT5009: 'Telerik' is undefined
OData.js, line 1 character 2
SCRIPT5009: 'Type' is undefined
NavigationScripts.js, line 1 character 1
SCRIPT5009: 'Telerik' is undefined
RadMenuScripts.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
AnimationScripts.js, line 1 character 1
SCRIPT5009: '$telerik' is undefined
TouchScrollExtender.js, line 1 character 2
SCRIPT5009: 'Type' is undefined
PopupScripts.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadWindowScripts.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadPickersPopupDirectionEnumeration.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadDatePicker.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadInputScript.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadDateInputScript.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadCalendarCommonScript.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadCalendarScript.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadComboBoxScripts.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadButton.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadWindowManager.js, line 1 character 1
SCRIPT5009: 'Type' is undefined
RadGridScripts.js, line 1 character 1
SCRIPT5009: '$telerik' is undefined
RadListBoxScripts.js, line 1 character 1
SCRIPT5009: 'Sys' is undefined
C:\Users\skey\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\5V1A5JKX\dashboard.mht, line 91 character 1
SCRIPT5009: 'Telerik' is undefined
C:\Users\skey\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\5V1A5JKX\dashboard.mht, line 2195 character 1
SCRIPT5009: '$find' is undefined
C:\Users\skey\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\5V1A5JKX\dashboard.mht, line 1288 character 5
0
Peter
Telerik team
answered on 05 Jun 2012, 12:43 PM
Hi Whit,

That's strange. I tested several online demos (for example this one) and they all created a .mht file which opens without problems. Can you save your problematic page from the browser (File -> Save as...) instead of from code and test if the .mht file opens as expected?


All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
whit
Top achievements
Rank 1
answered on 05 Jun 2012, 03:26 PM
Peter,
Thanks for hanging with me on this.  I tried your suggestion using the example link you provided.  After saving the file I closed all browser instances and clicked the .mht file.  It did bring back a nice looking page as expected.  However it does reach out to the telerik site to get the Telerik controls and some other resources.  To prove that, I unplugged my network cable, cleared my browsers cache and clicked the mht file again.  This time I got no Telerik controls and the css was pretty much missing, very similar to what I have been experiencing all along.  If our site was public, this would be no problem, but alas this site is private.

It is interesting to note that via code, that the page I am trying to work with from our site takes up ~1meg but if I save with save as from the browser, it takes over 3 meg.  They both render pretty much the same with the combo boxes missing.  The save as version locks up the browser though. 
thanks,
whit

0
Peter
Telerik team
answered on 06 Jun 2012, 08:03 AM
Hello Whit,

Thank you for clarifying the case. I am not sure how we could workaround those problems, but another alternative that comes to mind is to consider exporting the page to a PDF document. There are a number of tools that could do this.

Greetings,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
whit
Top achievements
Rank 1
answered on 07 Jun 2012, 12:54 PM
Thanks, I will take a look at those alternatives.
lwhit
Tags
General Discussions
Asked by
whit
Top achievements
Rank 1
Answers by
Peter
Telerik team
whit
Top achievements
Rank 1
Share this question
or