2015-09-30 108 views
1

创建一个具有“异步文件上传”控件的自定义控件。 但是,当我试图添加异步FileUpload控件不能添加获取Complie时间错误。 以下是我的代码AsyncFileUpload动态添加自定义控件

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

VS遇到无效参数错误时会产生一对错误消息。第二条消息告诉接收的类型方法以及它期望接收的类型。你也可以显示这个编译器错误吗? –

回答

2

得到问题的解决方案 刚刚添加到我的项目和它的完成system.web.Extension的参考。