asp.net – UserControl有IsPostBack,但是Control没有
发布时间:2020-12-16 00:07:35 所属栏目:asp.Net 来源:网络整理
导读:我正在尝试解决Visual Studio中的错误,the suggestion is to stop using UserControls and use Control instead.. 所以我将我的所有UserControl转换为Control,例如: public partial class Controls_UserManagement_GroupManager : System.Web.UI.UserContro
我正在尝试解决Visual Studio中的错误,the suggestion is to stop using
UserControls and use Control instead..
所以我将我的所有UserControl转换为Control,例如: public partial class Controls_UserManagement_GroupManager : System.Web.UI.UserControl { protected void Page_Load(object sender,EventArgs e) { if (!IsPostBack) 变 public partial class Controls_UserManagement_GroupManager : System.Web.UI.Control { protected void Page_Load(object sender,EventArgs e) { if (!IsPostBack) 除了没有Control.IsPostBack? 如何用Control替换UserControl? 系列 这个问题是正在进行的Stackoverflow系列中的一个,“模板化用户控件”: > How to add a Templating to a UserControl? 解决方法
Control有一个Page属性,它有一个IsPostback属性.这应该为您提供所需的价值.
public class MyControl : Control{ protected override void OnInit( EventArgs e ){ if( this.Page.IsPostBack ){ // do something } } } MSDN Reference (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 如何在Ember.js应用程序中使用ASP .NET Web API
- ASP.NET WebApi RESTful标准
- ASP.NET MVC – Response.Write代码 – 将它放在Controller
- asp.net-mvc-4 – ASP.Net MVC 4和WebSecurity – 通过电子
- 巢内生育咨询电话多少
- asp.net-mvc-3 – ASP.NET MVC 3,RavenDB和Autofac Issue P
- asp.net-core – ASP.NET核心中的Angular CLI,具有热模块替
- 动手造轮子:实现一个简单的依赖注入(二) --- 服务注册优化
- ASP.Net下载大文件的实现方法
- asp.net – 如何防止低效的SQL查询减慢数据库服务器的速度
推荐文章
站长推荐
- .net核心中的ServicePointManager.DefaultConnec
- asp.net-mvc – 从/到POCO对象的knockoutjs映射
- asp.net – 是否有可能欺骗或重用VIEWSTATE或检测
- asp.net-mvc – EntityFramework.SqlServer未在W
- 在ASP.NET MVC中使用自定义验证替换默认客户端验
- asp.net – 使用ClientScriptManager.RegisterFo
- 将ASP.NET验证与JQuery相结合的优雅方式
- ASP.NET MVC中的runat =“server”标签的状态是什
- asp.net-mvc – MVC – 重定向在构造函数内
- asp.net-mvc – ASP.Net MVC和jQuery表单插件上传
热点阅读