最新下载
热门教程
- 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()方法,当在运行时改变了控件属性,可调用此方法重新构造控件,它调用一系列的内部过程:管理视图状态,清空子控件,重新初始化数据集,创建标题行、创建数据行、创建操作行等:
相关文章
- 航海王壮志雄心阿保有什么玩法技巧 11-04
 - 星塔旅人菈露有什么技能 11-04
 - 潮汐守望者希瑟拉强度怎么样 11-04
 - 洛克王国世界刺电环如何进化 11-04
 - 原神幽境危战霜役人打法教学 11-04
 - 超自然行动组最新小抄分享 2025实用攻略技巧汇总 11-04