AsyncFileUpload动态添加自定义控件

时间:2015-09-30 14:05:05

标签: c# custom-controls ajaxcontroltoolkit

创建一个具有异步文件上载控件的自定义控件。 但是当我尝试在控件中添加Async FileUpload时无法添加获取Complie时间错误。 以下是我的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AjaxControlToolkit;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SBITS.CustomControl
{
class CustomFileUpload:CompositeControl
{

    private AsyncFileUpload asyncFileUpload;

    private Image throbberImage;


    protected override void CreateChildControls()
    {

        this.throbberImage = new Image();
        this.throbberImage.ImageUrl = Constant.THROBBER_IMAGE_PATH;
        this.Controls.Add(throbberImage);

        this.asyncFileUpload = new AsyncFileUpload();
        this.asyncFileUpload.ThrobberID = throbberImage.ID;
        this.Controls.Add(asyncFileUpload);
    }
}  }

在此行上收到错误

 this.Controls.Add(asyncFileUpload);

错误屏幕

enter image description here

编译时间错误

enter image description here

1 个答案:

答案 0 :(得分:2)

得到了解决问题的方法 刚刚将system.web.Extension的引用添加到我的项目及其完成中。