惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
Attack and Defense Labs
Attack and Defense Labs
V2EX - 技术
V2EX - 技术
O
OpenAI News
S
Secure Thoughts
H
Heimdal Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Schneier on Security
Schneier on Security
H
Hacker News: Front Page
S
Security Affairs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
The Register - Security
The Register - Security
GbyAI
GbyAI
Cloudbric
Cloudbric
MongoDB | Blog
MongoDB | Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
Forbes - Security
Forbes - Security
Y
Y Combinator Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
The Cloudflare Blog
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
Webroot Blog
Webroot Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog
T
Tor Project blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
I
Intezer
V
V2EX
T
Tailwind CSS Blog
SecWiki News
SecWiki News
NISL@THU
NISL@THU
C
Check Point Blog

博客园 - 哪热

虚拟机安装 VMware7.0 + ubuntu10.10 转载:Oracle学习:数据库规划 CHM 不能打开的问题 VS2005水晶报表在时部署时遇到的问题 如何设置开机自启动 解决先装VS再装IIS的出错 笔记本电脑如何来拷屏? oracle 不能更新 PL/SQL 点击“edit data”报“ these query results are not updateable” 封装一个访问Oracle数据库的类 从本地拖资源到远程桌面上如何设置 在Visual Studio 2005中进行Javascript的调试 .Net 点击实现验证码的刷新(转载) 如何获取服务器的IP Visual Studio .NET 无法创建应用程序 。问题很可能是因为本地 Web 服务器上没有安装所需的组件 ----转载 转载:VS2008转VS2005 斐波那契(Fibonacci)数列 素数 URL的传递字符串问题小研究(续) GridView数据更新问题
如何在aspx文件中调用关联的cs文件中的属性
哪热 · 2009-03-18 · via 博客园 - 哪热

      想在前台的页面中调用关联的CS文件中的属性,或是变量。应该怎么做呢?

    我今天遇到了这个问题,后来在同事的帮助下解决了这个问题,所以提供给大家参考。

     在aspx文件中的语法是<%# var %>,然后在 CS文件中使用Data.Bind();必须绑定数据,否则页面生成时无法调用。

   在Script中调用的语法是 '<%= var %>' ;这样脚本函数就能获取这个变量了。

aspx中的代码:

<asp:Label ID="Label1" runat="server"  Text="<%# CurveIP %>" > </asp:Label>

Script中的函数传值:

 <input id="Button1" type="button" value="button" onclick="Load('<%= CurveIP %>');"/>

CS中的代码:

Code

我需要达到的目的是:前台页面需要从web.config文件中读取一个值来,所以我在页面关联的cs中设置一个属性,然后页面文件aspx来读取这个属性。改变下代码就OK了。

Web.config文件中,设置我要的值:

 <appSettings>
    
<add key="CurveIP" value="100.0.0.170"/>
</appSettings>

CS文件中:

Code