最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
全编辑WebGrid控件LrcGrid(6)――控件呈现
时间:2022-06-30 10:39:36 编辑:袖梨 来源:一聚教程网
全编辑WebGrid控件LrcGrid(6)――控件呈现
创建子控件
重写CreateChildControls()过程,调用创建子控件的方法ReBuild()
每当 ASP.NET 页框架需要创建控件树时就会调用CreateChildControls()方法,且该方法调用并不限于控件生命周期的特定阶段。例如,可以在加载页时、在绑定数据过程中或者在呈现过程中调用CreateChildControls
protected override void CreateChildControls()
{
this.ReBuild();
}
重写OnPreRender(EventArgs e)过程,注册客户端脚本块,此脚本可使用户回车时进行焦点跳转,注释掉的部分为使用资源文件的方法.
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender (e);
if(this._isTabChg)
{
if(!Page.IsClientScriptBlockRegistered("lrc_chgTab"))
{
string str_chgTab = @"";
Page.RegisterClientScriptBlock("lrc_chgTab",str_chgTab);
}
}
/*
*
ResourceManager manager = new ResourceManager(this.GetType());
ResourceSet resources = manager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture,true,true);
if(!Page.IsClientScriptBlockRegistered("LiuRuiCai.LrcGrid.Script"))
{
string script = resources.GetString("ClientScript");
this.Page.RegisterClientScriptBlock("LiuRuiCai.LrcGrid.Script",script);
string style = resources.GetString("ClientStyle");
this.Page.RegisterClientScriptBlock("LiuRuiCai.LrcGrid.Style",style);
}
*/
}
ReBuild()方法,当在运行时改变了控件属性,可调用此方法重新构造控件,它调用一系列的内部过程:管理视图状态,清空子控件,重新初始化数据集,创建标题行、创建数据行、创建操作行等:
创建子控件
重写CreateChildControls()过程,调用创建子控件的方法ReBuild()
每当 ASP.NET 页框架需要创建控件树时就会调用CreateChildControls()方法,且该方法调用并不限于控件生命周期的特定阶段。例如,可以在加载页时、在绑定数据过程中或者在呈现过程中调用CreateChildControls
protected override void CreateChildControls()
{
this.ReBuild();
}
重写OnPreRender(EventArgs e)过程,注册客户端脚本块,此脚本可使用户回车时进行焦点跳转,注释掉的部分为使用资源文件的方法.
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender (e);
if(this._isTabChg)
{
if(!Page.IsClientScriptBlockRegistered("lrc_chgTab"))
{
string str_chgTab = @"";
Page.RegisterClientScriptBlock("lrc_chgTab",str_chgTab);
}
}
/*
*
ResourceManager manager = new ResourceManager(this.GetType());
ResourceSet resources = manager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture,true,true);
if(!Page.IsClientScriptBlockRegistered("LiuRuiCai.LrcGrid.Script"))
{
string script = resources.GetString("ClientScript");
this.Page.RegisterClientScriptBlock("LiuRuiCai.LrcGrid.Script",script);
string style = resources.GetString("ClientStyle");
this.Page.RegisterClientScriptBlock("LiuRuiCai.LrcGrid.Style",style);
}
*/
}
ReBuild()方法,当在运行时改变了控件属性,可调用此方法重新构造控件,它调用一系列的内部过程:管理视图状态,清空子控件,重新初始化数据集,创建标题行、创建数据行、创建操作行等:
相关文章
- 地狱即我们调查道具怎么获取 获取方式及使用方法一览 09-18
- 无主之地4伊瑟图斯怎么打 原始秘藏护卫打法攻略 09-18
- 地狱即我们调查道具有什么 获取方式及使用方法一览 09-18
- 无主之地4万物皆可卖成就怎么达成 万物皆可卖成就解锁攻略 09-18
- 地狱即我们全章节怎么过 1-15章流程视频攻略总览 09-18
- 无主之地4安全屋怎么占领 安全屋占领方法 09-18