[asp.net] 页面生命周期中注册事件与重写页面方法
2009-09-11 17:35
267 查看
重写页面方法
一个自定义控件继承自ImageButton控件,在控件render之前设置其ImageUrl属性:protected override void OnPreRender( EventArgs e )
{
// setup inital image state
this.ImageUrl = PageContext.Theme.GetCollapsiblePanelImageURL( PanelID, DefaultState );
UpdateAttachedVisibility();
base.OnPreRender( e );
}
注册事件
某用户控件中包含一个asp:Label,在用户控件render之前设置该Label的Text属性:public ForumWelcome()
{
this.PreRender += new EventHandler( ForumWelcome_PreRender );
}
void ForumWelcome_PreRender( object sender, EventArgs e )
{
// 设置用户控件页面上Label的Text值
TimeNow.Text = String.Format( PageContext.Localization.GetText( "Current_Time" ),
YafDateTime.FormatTime( DateTime.Now ) );
}
相关文章推荐
- [转]ASP.NET一个页面多个Button按钮事件避免数据验证控件冲突方法
- ASP.NET - 自定义控件处理页面事件(控件与页面数据交互)的方法
- 那些年朋友劝,该知道的ASP.NET - 自定义控件处理页面事件(控件与页面数据交互)的方法
- (转)ASP.NET一个页面多个Button按钮事件避免数据验证控件RequiredFieldValidator冲突方法
- ASP.NET最常用的页面生命周期事件
- asp.net页面生命周期事件执行顺序
- ASP.NET-使用Alert事件导致页面错位的解决方法
- Asp.net 页面生命周期各个阶段引发的事件
- asp.net页面生命周期--应用程序级事件,页面级事件,服务器控件级事件
- Asp.net Ajax 客户端页面生命周期原生事件 - 博客园
- ASP.NET页面按钮单击事件失效的解决方法
- asp.net页面触发事件panel滚动条高度不变的实现方法
- Asp.Net页面无法注册__dopostback事件
- ASP.NET页面按钮单击事件失效的解决方法
- asp.net在事件中启动线程来打开一个页面的实现方法
- 【笔记】Asp.net 页面生命周期与生命周期的主要事件
- IIS如何处理Asp.net请求和Asp.net页面生命周期方法
- asp.net页面触发事件panel滚动条高度不变的实现方法
- ASP.NET 页生命周期概述 与 运行page页面时的事件执行顺序 【转】
- ASP.NET一个页面多个Button按钮事件避免数据验证控件冲突方法