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

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - 哪热

虚拟机安装 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