Dear All,
Can someone please help me with AsyncUpload control inside RadGrid since I am really new with Telerik controls.
I have a DB table with column names as:
RecordID Name AttachmentPath
1 Name1 ~/Attachments/File123_1.pdf
2 Name2 ~/Attachments/File125_2.pdf
Below are what I did:
- Inserted RadGrid with its default functionality of Inserting, Editing, and Deleting. (Works Perfect)
- Inserted AsyncUpload control inside RadGrid for uploading files. (Works Perfect)
<
telerik:GridTemplateColumn
>
<
EditItemTemplate
>
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
TargetFolder
=
"~/Attachments"
OnFileUploaded
=
"RadAsyncUpload1_FileUploaded1"
>
</
telerik:RadAsyncUpload
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
3. Fired the OnFileUploaded event to upload control in a path. (Works Perfect)
protected
void
RadAsyncUpload1_FileUploaded1(
object
sender, FileUploadedEventArgs e)
{
string
rootPath =
"~/Attachments/"
;
string
path = Server.MapPath(createSubFolder(rootPath));
e.File.SaveAs(path + e.File.GetName());
}
Below are what I want:
- While adding new record & uploading file with it, the file should be renamed with the table Record ID of RadGrid as OrignalFileName + "_" + RecordID
- The FileName from point#1 should be stored in AttachmentPath (DB Column name).
- While editing a selected record from RadGrid, I should be also able to edit associated file such as delete the file, etc.
Point to be noted, I want only one file to be associated/attached per record.
Thanks In Advance,
Fawad Surosh