Hi,
I am having a problem in sending radgrid data in Email
scenario: I have a radgrid on my web form, I want to send that data grid data in mail by clicking on mailto: button
what I am doing: I am capturing the innerhtml which lies in <div></div> tags and sending to mail
what happening : innerhtml or html source is directly going into mail and when copy that source and save it as in html format, and when i opens the stored html file I can see the grid data.
The following is code which I used :
| <script type="text/javascript"> |
| function OpenOutlookDoc() |
| { |
| try |
| { |
| var outlookApp = new ActiveXObject("Outlook.Application"); |
| var nameSpace = outlookApp.getNameSpace("MAPI"); |
| mailFolder = nameSpace.getDefaultFolder(6); |
| mailItem = mailFolder.Items.add('IPM.Note.FormA'); |
| mailItem.Subject="a subject test"; |
| mailItem.To = "an@email.here"; |
| mailItem.HTMLBody = "<b>bold</b>"; |
| mailItem.display (0); |
| } |
| catch(e) |
| { |
| alert(e); |
| } |
| } |
| function sanitizeHTML(s) |
| { |
| var d = document.createElement('div'); |
| d.appendChild(document.createTextNode(s)); |
| return d.innerHTML; |
| } |
| function SendMail(ctrl) |
| { |
| // var h = sanitizeHTML(window.document.getElementById("dvMail").outerHTML); |
| // alert(h); |
| // //window.document.getElementById("dvMail").innerHTML = "<pre>" + h + "</pre>"; |
| // ctrl.href.innerHTML = "<pre>" + h + "</pre>"; |
| // //alert(ctrl.href); |
| ctrlctrl.href = ctrl.href.replace("##body##", window.document.getElementById("dvMail").innerHTML); |
| alert(ctrl.href); |
| return true; |
| } |
| </script> |
| <a href="mailto:rama.k@abc.com">Email</a> |
| <a href="mailto:rama.k@abc.com?subject=my report &body=see attachment &attachment=\\myhost\myfolder\myfile.lis"></a> |
| <br /> |
| <a onclick="Javascript:return SendMail(this);" href="mailto:rama.k@abc.com?subject=RadGrid&body=##body##">Send me an email</a> |
| <br /> |
| <a href="mailto:rama.k@abc.com?subject=Feedback for |
| webdevelopersnotes.com&body=The Tips and Tricks section is great |
| &cc=anotheremailaddress@anotherdomain.com |
| &bcc=onemore@anotherdomain.com">Send me an email with cc,bcc</a><br /> |
| <br /> |
| <a href='mailto:rama.k@abc.com?subject=Software&body=see attachment&attachment="C:/certreq.txt"'> |
| Try with attachment<br /> |
| </a> |
| <a href="mailto:someone@somewhere.net?attachment=\\cheese02\Scans\invoices\1234\1234.tif"></a> |
| <br /> |
| <script language="javascript" type="text/javascript"> |
| function string strdestination() |
| { |
| return 'mailto:email@email.com?subject=Software&body=see attachment&attachment="L:/Parallel Drivers/Win 2k-xp.zip"' |
| } |
| </script> |
| <div id="dvMail"> |
| <telerik:radgrid id="RadGrid1" runat="server" datasourceid="ObjectDataSource1" gridlines="None"> |
| <MasterTableView DataSourceID="ObjectDataSource1"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:radgrid> |
| </div> |
| <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" |
| TypeName="UserWorkloadManipulation"></asp:ObjectDataSource> |
so, to see the radgrid data in mail what shoul I do?
can any one help
Thanks,