Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filling multiple literals with the same value

I have multiple literals on a page. For example,

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

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?

like image 233
majestiq Avatar asked Jun 29 '26 23:06

majestiq


1 Answers

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.

like image 68
Jimmie R. Houts Avatar answered Jul 02 '26 12:07

Jimmie R. Houts



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!