编写组件,使用JavaScript更新UpdatePanel
2010-09-14 13:31:00 来源:WEB开发网然后开始考虑编写最关键的JavaScriptUpdater类。首先定义它的简单框架,如下:
JavaScriptUpdater控件的总体框架与属性定义
namespace UpdatePanelHelper
{
[PersistChildren(false)]
[ParseChildren(true)]
[NonVisualControl]
public class JavaScriptUpdater : Control
{
private bool initialized = false;
private bool _Enabled = true;
public bool Enabled
{
get
{
return this._Enabled;
}
set
{
if (this.initialized)
{
throw new InvalidOperationException( "Cannot set the property after initialized.");
}
this._Enabled = value;
}
}
private string _MethodName;
public string MethodName
{
get
{
return this._MethodName;
}
set
{
if (this.initialized)
{
throw new InvalidOperationException( "Cannot set the property after initialized.");
}
this._MethodName = value;
}
}
public event EventHandler<ResolveUpdatePanelEventArgs> ResolveUpdatePanel;
private List<UpdatePanel> _UpdatePanels = new List<UpdatePanel>();
[PersistenceMode(PersistenceMode.InnerProperty)]
public List<UpdatePanel> UpdatePanels
{
get
{
return _UpdatePanels;
}
}
...
}
}
更多精彩
赞助商链接