0

I have this code in my view page

<asp:HyperLink ID="hyperlink_TruckList" runat="server" 
     Text="Truck List" NavigateUrl="~/View/Trucklist.aspx" 
     Font-Underline="false"></asp:HyperLink>

How to add -

class="col-sm-4" 
style="text-align: center; font-size: 18px; color: black; height: 40px; padding-top: 8px; background: #E8D73E">

and

<i class="glyphicon glyphicon-home"></i> 

on it?

3 Answers 3

2

Server Control CssClass and Style property are equivalent to HTML class and style attribute respectively.

<asp:HyperLink ID="hyperlink_TruckList" runat="server" Text="Truck List" NavigateUrl="~/View/Trucklist.aspx" Font-Underline="false" CssClass="col-sm-4" Style="text-align: center; font-size: 18px; color: black; height: 40px; padding-top: 8px; background: #E8D73E">
     <i class="glyphicon glyphicon-home"></i>
</asp:HyperLink>
Sign up to request clarification or add additional context in comments.

Comments

0

Firstly add this in your css file

.need
{
text-align: center; font-size: 18px; color: black; 
height: 40px; padding-top: 8px; background: #E8D73E;
}

and then simply write this code

<asp:HyperLink ID="hyperlink_TruckList" runat="server" 
 Text="Truck List" NavigateUrl="~/View/Trucklist.aspx" CssClass="col-sm-4 need"
 Font-Underline="false">
        <i class="glyphicon glyphicon-home"></i> 
</asp:HyperLink>

Comments

0

You can append styles programmatically

hyperlink_TruckList.Style.Add("class", "col-sm-4");
hyperlink_TruckList.Style.Add("style", "text-align: center; font-size: 18px; color: black; height: 40px; padding-top: 8px; background: #E8D73E");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.