asp.net – 在.NET .NET中ctl00是常量吗?
发布时间:2020-12-16 04:36:33 所属栏目:asp.Net 来源:网络整理
导读:我需要在我的Web应用程序中引用一个使用母版页生成的控件. HTML中控件的名称变为类似“ctl00 $MainContent $ListBox1”.我可以在代码中安全地执行此操作吗? string strName = "ctl00$MainContent$ListBox1";if (Request.Form[strName] != null){String sele
我需要在我的Web应用程序中引用一个使用母版页生成的控件.
HTML中控件的名称变为类似“ctl00 $MainContent $ListBox1”.我可以在代码中安全地执行此操作吗?
string strName = "ctl00$MainContent$ListBox1"; if (Request.Form[strName] != null) { String selectedLanguage = Request.Form[strName]; } PS.我不能使用ClientID属性,因为从InitializeCulture()覆盖调用此代码. 解决方法
你可以,但我做的是在我的Init()中设置MasterPage ID:
protected void Page_Init( object sender,EventArgs e ) { // this must be done in Page_Init or the controls // will still use "ctl00_xxx",instead of "Mstr_xxx" this.ID = "Mstr"; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 从ASP.Net页面通过C#将NetworkCredential传递给HttpWebRequ
- asp-classic – 为什么这个函数与任意数字相比作为空检查?
- ASP.NET核心中的Redis缓存
- asp.net – Response.TrySkipIisCustomErrors不工作
- asp.net – ASPX需要一个免费的datepicker
- asp.net-web-api – WebAPI 2.2不支持substringof函数
- asp.net-core – 项目’XXXXXX’没有锁文件.请运行“dotnet
- Azure AAD – 受众群体无效
- .net – 如何在ASP成员资格中使用LogOut
- asp.net – 使用Jquery访问hiddenfield
推荐文章
站长推荐
- asp.net-mvc – ASP.NET MVC 3列表到IEnumerable
- asp.net-mvc – 隐藏日期时间的ASP.NET MVC格式
- .NET Core采用的全新配置系统[5]: 聊聊默认支持的
- iis – 是否需要serviceAutoStartProvider属性来
- asp.net-mvc – ASP.NET MVC向最终用户显示操作成
- asp.net-mvc-3 – MvcMiniProfiler 1.9 – VS或运
- asp.net-mvc – 域实体,DTO和查看模型
- asp.net-mvc – 在ASP.NET MVC3中有一个无会话控
- asp.net-mvc – 为什么删除:ASP.NET MVC CheckB
- 在ASP.Net MVC中长时间运行SQL查询的最佳实践
热点阅读