基本上我想找到一种方法来做类似以下的事情:
<asp:Label ID="lID" runat="server" AssociatedControlID="txtId" Text="<%# MyProperty %>"></asp:Label>
我知道我可以在代码后台设置它(使用 lId.Text = MyProperty),但我更喜欢在标记中完成,只是我的确找不到解决方案。(MyProperty 是一个字符串属性)
`Text='<%# MyProperty %>'`
不管怎样,谢谢。你的答案是唯一一个99%正确的 :)另外值得注意的是,你也可以这样做:`Text='<%# myClass.MyProperty %>'`
- maplemale