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

How to capturing radGrid data and Sendig that data in outlook mail?

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 09 Mar 2009, 01:12 PM

 

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> 
 
<href="mailto:rama.k@abc.com">Email</a> 
 
<href="mailto:rama.k@abc.com?subject=my report &body=see attachment &attachment=\\myhost\myfolder\myfile.lis"></a> 
<br /> 
      
<onclick="Javascript:return SendMail(this);" href="mailto:rama.k@abc.com?subject=RadGrid&body=##body##">Send me an email</a> 
<br /> 
 
<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 /> 
 
<href='mailto:rama.k@abc.com?subject=Software&body=see attachment&attachment="C:/certreq.txt"'>  
Try with attachment<br /> 
</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,

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 11 Mar 2009, 02:35 PM
Hi Ram,

One possible option in this case would be to get the cell data in the control, store it in a mail object, and send it:

SmtpMail.Send(objMM)

I hope this suggestion helps!

Greetings,
Yavor
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
Ram
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or