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
>
查看全文
相关阅读:
VS Code的使用
跨平台C++ IDE
windows CMakeLists.txt
Windows引用opencv静态库
【wpf】WPF程序处理多线程的两种方式
【c#】System.Reflection.TargetInvocationException 调用的目标发生了异常/System.Threading.ThreadAbortException:正在中止线程
【WinForm】Dev ProgressBarControl 使用汇总
【WPF】UserControl用户控件怎么添加到Window窗体中
【WPF】WPF无边框、窗体初始化位置与可拖拽窗体的解决方案
【c#】未加载mscorlib.pdb/System.Reflection.TargetParameterCountException 未经处理的异常在mscorlib.dll中发生/参数计数不匹配
原文地址:https://www.cnblogs.com/Microshaoft/p/137098.html
最新文章
qScrollArean的使用
office每次打开都要重新配置
Inno Setup 编译器操作
Cxfreeze使用存在问题
Python_Cxfreeze打包exe
Word发布到cnblogs文章
磁盘整理操作
允许安装任何来源文件
oracle增加表空间
Vysor安装图解
热门文章
list<map>排序
app.jsNodejs启动测试服务
currentSession
RowMapper使用
Windows下MD5校验
Opencv模块
opencv编译静态库时选择MD模式无效的原因
opencv静态编译
安装boost
Windows使用nmake和Makefile编译c++
Copyright © 2011-2022 走看看