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

Sending Email with Attachment inside Radgrid EditForm Template

2 Answers 261 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carina
Top achievements
Rank 1
Carina asked on 09 May 2013, 08:51 PM
I have a question on functionality inside the Radgrid's EditForm Template. I want to be able to Edit a record, and based on whether a check box is checked or not, a text box and a Radupload control will appear. When I input something in the text box, I also want to upload a file onto the record, and once I hit update, it sends out an email with the uploaded file as an attachment. I was able to make the email part work with the text box value as the body of the email. The thing I am having difficulty uploading a file and sending it as an attachment in the email. Is this possible? Here is a screenshot of my current EditForm Template.

2 Answers, 1 is accepted

Sort by
0
Carina
Top achievements
Rank 1
answered on 13 May 2013, 04:51 PM
Ok, so I got this to work, now I have another question. Now that I uploaded the file and sent it as an attachement, when I go back to that form, it has added a column in the grid with the filename.  Attached is a picture. How does this happen? And how can I make it not visible?

Here is my vb.net code:

 With NewMail
 NewMail.From = (ApproverEmail)
 NewMail.Subject = (Subject)
 NewMail.To.Add(EmailAddress)
 NewMail.IsBodyHtml = True
 NewMail.Body = (Body)

If RUAttach.UploadedFiles.Count > 0 Then
Dim a As New Attachment(RUAttach.UploadedFiles(0).InputStream, System.IO.Path.GetFileName(RUAttach.UploadedFiles(0).FileName))
NewMail.Attachments.Add(a)
ElseIf RUAttach.UploadedFiles.Count < 0 Then
End If

SMTP.SendEmail(NewMail)
NewMail.Dispose()
End With


and here is my aspx on the radasyncupload properties inside the EditForm Template:
 <telerik:RadAsyncUpload  ID="RUAttach" uniquename="RUAttach" ControlObjectsVisibility="None" MultipleFileSelection="Disabled" 
                                                runat="server" AllowedFileExtensions=".pdf,.doc,.rtf,.xls,.docx,.xlsx,.zip" >
</telerik:RadAsyncUpload>
0
Tsvetoslav
Telerik team
answered on 14 May 2013, 02:08 PM
Hello Carina,

That's because you have a column to display that field from your underlying data-source. Just remove the column or set its Display property to false.

Hope it helps.

Regards, Tsvetoslav
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.
Tags
Grid
Asked by
Carina
Top achievements
Rank 1
Answers by
Carina
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or