1

我正在尝试扩展 AsyncFileUploadEventArgs 类。下面是我的代码

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;
    }
}

AsyncFileUploadEventArgs类元数据

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; }
}

下面是AsyncFileUpload UploadedComplete处理程序

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

下面是 AsyncFileUpload 的用户控件

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

我的动机是 - 我正在尝试验证AsyncFileUpload1_UploadedComplete处理程序中所选文件的高度和宽度。我在服务器端做,因为高度和宽度在AsyncFileUploadEventArgs类中不可用。

因此,我正在考虑添加名为 Height 的新属性并将其分配为服务器端的值并在客户端访问它。

通过扩展类,它给了我以下错误

“AsyncFileUpload1_UploadedComplete”没有重载匹配委托“System.EventHandler”

你能说出原因吗?

4

1 回答 1

-2

应该将此参数用于 UploadedComplete 事件:

protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
于 2013-04-08T17:12:34.230 回答