灌装多个文字用相同的值 [英] Filling multiple literals with the same value

查看:119
本文介绍了灌装多个文字用相同的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面上的多个文字。例如,

I have multiple literals on a page. For example,

<asp:Literal id="Label1" runat="server" />

我的这10个左右在一个页面上,并希望填充它们都具有相同的值。有没有做,没有引用id为每个控件的好办法?

I have around 10 of these on one page and want to fill them all with the same value. Is there a good way to do that without referencing the id for each control?

推荐答案

创建包含要显示和值的公共财产在ASPX使用

Create a public property that holds the value you want to display and in the aspx use

<%= propertyName %>

处处要显示的值。

everywhere you want to display the value.

这篇关于灌装多个文字用相同的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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