AsyncFileUpload within EditItemTemplate of ListView
I'm having trouble handling an AsyncFileUpload
control within an EditItemTemplate
in a ListView开发者_JAVA百科
.
How do I reference the the AsyncFileUpload
control when handling the OnUploadedComplete
event in the code behind file?
I know that I can reference it within the OnItemUpdating
event for the ListView
but since it's an AsyncFileUpload
how do I upload the file before saving the updates to the ListView
item?
Thanks
You can reference it casting sender in the event handling code :
protected void AttachmentAsyncFileUpload_Complete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
var FileUploader = sender as AjaxToolkit.AsyncFileUpload;
FileUploader.SaveAs("testuploadedfile.tmp");
}
精彩评论