foreach (Control item in form1.Controls)
{
try {
((Label)item).BorderColor = System.Drawing.Color.Azure;
}
catch { }
}
Only labels are changed.
If you want check selected label you can use:
if( item.UniqueID == "lblIDn")
سؤال
Is it possible to set the font property to affect all tags, and nothing else on a single aspx page?
I have about 40 Labels throughout my page that all look the same as this, with varying IDs of course ...
<asp:Label ID="lblIDn" runat="server" Text='<%# Eval("somecolumn" ) %>' Backcolor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" Width="30" Font-Names="Arial" Font-Size="Small"></asp:Label>
I don't want to have to change all 40 labels one by one. Is there a way to set them all like this, using CSS perhaps?
Thanks
المحلول
foreach (Control item in form1.Controls)
{
try {
((Label)item).BorderColor = System.Drawing.Color.Azure;
}
catch { }
}
Only labels are changed.
If you want check selected label you can use:
if( item.UniqueID == "lblIDn")