1:动态添加控件很简单,如:
- this.ToolBar1.DirectClick += new ComponentDirectEvent.DirectEventHandler(ToolBar1_DirectClick);
但需注意的,不能在Page_Load事件中不能将此行包含中如下代码中,否则会报以下错误:
The control 'fbtn_Insert' does not have an DirectEvent with the name 'Click' or the handler is absent- if (!X.IsAjaxRequest)
-
{
-
//错误做法
-
this.ToolBar1.DirectClick += new ComponentDirectEvent.DirectEventHandler(ToolBar1_DirectClick);
-
}
或:
- if (IsPostBack)
-
{
-
//错误做法
-
this.ToolBar1.DirectClick += new ComponentDirectEvent.DirectEventHandler(ToolBar1_DirectClick);
-
}
阅读(1479) | 评论(0) | 转发(0) |