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
>
查看全文
相关阅读:
防盗链(三)nginx实现图片防盗链(referer指令)
防盗链(二)nginx secure_link下载防盗链
防盗链(一)资料整理
如何实现 token 加密
Socket编程(三)demo举例
Socket编程-(二)tcp三次握手与四次挥手
Spring的事务控制,注解和xml配置以及解释
SpringAop的核心概念和使用,表达式匹配刨析,xml配置通知和环绕通知
SpringAop的简介
Spring整合JUnit测试单元
原文地址:https://www.cnblogs.com/Microshaoft/p/137098.html
最新文章
pandas 由其中几列生成新的列
OpenSSL发布了2个高危漏洞的补丁程序
5G新缺陷!黑客可获得你的位置和拒绝服务攻击
新能源时代,黑客盯上电力设备,我们需要怎么防御?
苹果发布影响其数十亿设备的远程黑客漏洞补丁
东方联盟发现SolarWinds黑客使用的3种新恶意软件
Apple的“查找功能”可能暴露用户的位置历史记录
会计软件遭黑客攻击,QuickBooks数据盗窃现象大幅增加
线程池与Callable接口
多线程
热门文章
Objects、Arrays、Collectors、System工具类
内部类
super、this、抽象类、继承
shiro和redis集成,前后端分离
Apache Shiro简介
Git .gitignore 不起作用的解决办法
shiro-springboot整合,平行依赖
条码(二)必须知道的条码知识
条码(一)一维码生成技术
防盗链(四)用nginx lua模块做m3u8防盗链
Copyright © 2011-2022 走看看