I am facing an issue with the styling of a complex label.
The CSS code doesn't always apply as expected. Interestingly, when I ran this code on two different machines, the styles were inconsistent.
The code seems messy and disorganized to me, but all I want is to apply the CSS styles without altering the label's onclick functionality.
The following CSS attributes work: color, padding, float, background.
However, the rest of the CSS attributes do not work. Why?
Here is how the code looks:
aspx:
<asp:Label ID="lblResetOrder" CssClass="resetRequest" runat="server" Visible="false"></asp:Label>
css:
.resetRequest {
color:#7baa0f;
font-weight:bold;
font-size: 150%;
text-decoration: underline;
padding-left:8px;
float:right;
background:url(../Images/General/HyperLinkArrow.gif) left 4px no-repeat;
}
code behind:
For Each gvr As GridViewRow In gvRequests.Rows
CType(gvr.FindControl("lblResetOrder"), Label).Attributes.Add("onclick", "EnableCheckBoxes('" & CType(gvr.FindControl("chkbDeny"), CheckBox).ClientID & "', '" & CType(gvr.FindControl("chkbApprove"), CheckBox).ClientID & "', '" & CType(gvr.FindControl("lblResetOrder"), Label).ClientID & "')")
result html:
<span id="ctl00_ContentPlaceHolder1_gvRequests_ctl02_lblResetOrder" class="resetRequest" onmouseover="this.style.cursor='hand';" onclick="EnableCheckBoxes('ctl00_ContentPlaceHolder1_gvRequests_ctl02_chkbDeny', 'ctl00_ContentPlaceHolder1_gvRequests_ctl02_chkbApprove', 'ctl00_ContentPlaceHolder1_gvRequests_ctl02_lblResetOrder')">Reset</span>