如何将一个标签在标记'绑定'Text属性 [英] How to 'bind' Text property of a label in markup

查看:196
本文介绍了如何将一个标签在标记'绑定'Text属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想找到一种方法,DDO是这样的:

Basically I would like to find a way to ddo something like:

<asp:Label ID="lID" runat="server" AssociatedControlID="txtId" Text="<%# MyProperty %>"></asp:Label>

我知道我可以从code设置背后(写入lId.Text = myProperty的),但我preFER在标记做,我只是似乎无法找到解决方案。
(myProperty的是一个字符串属性)
欢呼声

I know I could set it from code behind (writing lId.Text = MyProperty), but I'd prefer doing it in the markup and I just can't seem to find the solution. (MyProperty is a string property) cheers

推荐答案

code EX pressions是一种选择为好。这些可以引号内使用ASP中的标签,与标准&LT;%=%>标签

Code expressions are an option as well. These can be used inside of quotes in ASP tags, unlike standard <%= %> tags.

一般语法是:

<%$ resources: ResourceKey %>

有一个内置的前$ P $为的appSettings pssion:

There is a built-in expression for appSettings:

<%$ appSettings: AppSettingsKey %>

在这个位置更多信息:<一href=\"http://weblogs.asp.net/infinitiesloop/archive/2006/08/09/The-$c$cEx$p$pssionBuilder.aspx\">http://weblogs.asp.net/infinitiesloop/archive/2006/08/09/The-$c$cEx$p$pssionBuilder.aspx

这篇关于如何将一个标签在标记'绑定'Text属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆