Hi
I am using RadGrid and I need to export it to email.
I looked in your forums and found this answer:
VB.NET:
The code in line 25 is not good for my project
because if I use the Response command it does a PostBack.
In my project the PostBack resets user configuration.
And if I delete the Response command, it sends an email and also creates a file in the user's computer.
I want only to send an email without PostBack and without creating a file in the user's computer.
How can I do that?
Thanks,
Daniel.
I am using RadGrid and I need to export it to email.
I looked in your forums and found this answer:
VB.NET:
01.
Private
Sub
RadGrid1_GridExporting(sender
As
Object
, e
As
GridExportingArgs)
Handles
RadGrid1.GridExporting
02.
03.
If
isLoc <>
True
Then
04.
05.
Dim
ms
As
New
MemoryStream(
New
UTF8Encoding().GetBytes(e.ExportOutput))
06.
07.
Dim
smtpClient
As
New
SmtpClient()
08.
smtpClient.EnableSsl =
True
09.
10.
Dim
mailMessage
As
New
MailMessage()
11.
mailMessage.IsBodyHtml =
True
12.
mailMessage.[
To
].Add(
New
MailAddress(Session(
"Email"
)))
13.
mailMessage.Subject =
"Reporting service - Do Not reply"
14.
mailMessage.Body =
"This report was sent from <br /><b>Reporting service</b> "
15.
mailMessage.Attachments.Add(
New
Attachment(ms,
"Reporting service"
& DocType))
16.
Try
17.
smtpClient.Send(mailMessage)
18.
'Label1.Text = "Message Sent"
19.
MsgBox(
"Message Sent"
)
20.
Catch
ex
As
Exception
21.
'Label1.Text = ex.ToString()
22.
MsgBox(
"Message not Sent"
)
23.
End
Try
24.
25.
Response.Redirect(Request.Url.ToString())
26.
27.
28.
29.
End
If
30.
End
Sub
The code in line 25 is not good for my project
because if I use the Response command it does a PostBack.
In my project the PostBack resets user configuration.
And if I delete the Response command, it sends an email and also creates a file in the user's computer.
I want only to send an email without PostBack and without creating a file in the user's computer.
How can I do that?
Thanks,
Daniel.