zoukankan
html css js c++ java
我提了愚蠢的问题: 如何在 Codebehind 中访问 WebUserControl (.ascx)?
卖个关子! 答案明天揭晓! 不要骂我!
其实很简单,在 ASPX 的 HTML 里可以访问到:
<%
@ Page language
=
"
c#
"
Codebehind
=
"
WebForm1.aspx.cs
"
AutoEventWireup
=
"
true
"
Inherits
=
"
WebApplication1.WebForm1
"
%>
<%
@ Register TagPrefix
=
"
uc1
"
TagName
=
"
WebUserControl1
"
Src
=
"
WebUserControl1.ascx
"
%>
<!
DOCTYPE HTML PUBLIC
"
-//W3C//DTD HTML 4.0 Transitional//EN
"
>
<
HTML
>
<
HEAD
>
<
title
>
WebForm1
</
title
>
<
meta name
=
"
GENERATOR
"
Content
=
"
Microsoft Visual Studio .NET 7.1
"
>
<
meta name
=
"
CODE_LANGUAGE
"
Content
=
"
C#
"
>
<
meta name
=
"
vs_defaultClientScript
"
content
=
"
JavaScript
"
>
<
meta name
=
"
vs_targetSchema
"
content
=
"
http://schemas.microsoft.com/intellisense/ie5
"
>
</
HEAD
>
<
body MS_POSITIONING
=
"
GridLayout
"
>
<
form id
=
"
Form1
"
method
=
"
post
"
runat
=
"
server
"
>
<
uc1:WebUserControl1 id
=
"
WebUserControl11
"
runat
=
"
server
"
></
uc1:WebUserControl1
>
<
script language
=
"
C#
"
runat
=
"
server
"
>
void
Page_Load(
object
sender, EventArgs e)
{
Response.Write(
"
HTML
"
);
this
.WebUserControl11.TextBox1.Text
=
"
HTML
"
;
//
调用在 Codebehind 里声明的 foo 方法将 WebUserControl 传到 Codebehind
this
.foo(WebUserControl11);
}
</
script
>
</
form
>
</
body
>
</
HTML
>
查看全文
相关阅读:
office(Word、Excel、PPT等图标异常和桌面无新建解决方案)
CentOS7安装搭建.Net Core 2.0环境-详细步骤
Win7系统system进程句柄数一直增加解决方案
安装.Net Framework 4.6.2时出现“无法建立到信任根颁发机构的证书链”解决方法
css关于定位那些事情
1份2015计划书
js关于弹也遮罩层
每日一句(2014-10-23)
每日一句(2014-10-17)
每日一句(2014-10-16)
原文地址:https://www.cnblogs.com/Microshaoft/p/137098.html
最新文章
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
Centos7下Docker安装Gogs搭建git服务器
热门文章
Centos7下安装与卸载docker应用容器引擎
SVN与Git比较的优缺点差异
CentOS7下用firewall-cmd控制端口与端口转发
打开网站提示“安全检测 | 百度云加速”,怎么办?
7z常用命令行&7z检测压缩包完整性&7z压缩包错误不执行rsync同步
VMware虚拟机中CentOS7的硬盘空间扩容
Centos7查询开机启动项服务
zabbix server is not running the information displayed may not be current
Centos7下zabbix安装与部署
dell r420 H310/H810阵列配置教程及常见问题
Copyright © 2011-2022 走看看