AsyncFileUpload 在自定义控件中动态添加
AsyncFileUpload Dynamically add in custom control
正在创建一个将具有异步文件上传控件的自定义控件。
但是,当我尝试在无法添加获取 Complie 时间错误的控件中添加 Async FileUpload 时。
以下是我的代码
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);
错误屏幕
编译时错误
已解决问题
刚刚将 system.web.Extension
的引用添加到我的项目并完成。
正在创建一个将具有异步文件上传控件的自定义控件。 但是,当我尝试在无法添加获取 Complie 时间错误的控件中添加 Async FileUpload 时。 以下是我的代码
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);
错误屏幕
编译时错误
已解决问题
刚刚将 system.web.Extension
的引用添加到我的项目并完成。