简体   繁体   中英

How to extend AsyncFileUpload class?

I am trying to extend the AsyncFileUploadEventArgs class. below is my code

public class abc : AsyncFileUploadEventArgs
{
    public abc() { }
    public int MyProperty { get; set; }

    public String FileName { get { return fileName; } }
    private string fileName;

    public string FileSize { get { return fileSize; } }
    private string fileSize;

    public AsyncFileUploadState State { get { return State; } }
    private AsyncFileUploadState state;

    public string StatusMessage { get { return statusMessage; } }
    private string statusMessage;

    public abc(AsyncFileUploadState state, string statusMessage, string filename, 
                                                                   string filesize)
    {
        this.fileName = filename;
        this.state = state;
        this.statusMessage = statusMessage;
        this.fileSize = filesize;
    }
}

MetaData of AsyncFileUploadEventArgs class

public class AsyncFileUploadEventArgs : EventArgs
{
    public AsyncFileUploadEventArgs();
    public AsyncFileUploadEventArgs(AsyncFileUploadState state, string statusMessage, string filename, string filesize);

    public string FileName { get; }
    public string FileSize { get; }
    public AsyncFileUploadState State { get; }
    public string StatusMessage { get; }
}

Below is the AsyncFileUpload UploadedComplete handler

protected void AsyncFileUpload1_UploadedComplete(object sender, abc e)
{
}

Below is the user control for AsyncFileUpload

<cc1:AsyncFileUpload ID="AsyncFileUpload1" Width="400px" 
    runat="server" OnUploadedComplete="AsyncFileUpload1_UploadedComplete" />

My motive is - I am trying to validate the Height and Width of the selected file in the AsyncFileUpload1_UploadedComplete handler. I am doing it server side because Height and Width are not available in the AsyncFileUploadEventArgs class.

So, I was thinking to add new property called Height and assign it's value server side and access it client side.

By extending the class it is giving me below error

No overload for 'AsyncFileUpload1_UploadedComplete' matches delegate 'System.EventHandler'

Can you please tell the reason ?

应该对UploadedComplete事件使用此参数:

protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM