user576700
user576700

Reputation: 610

Inject HTML markup into web forms button control text property

I wonder if it is possible to make something like this

<asp:Button ID="btnContinueShopping" OnClick="btnContinueShopping_Click" runat="server" Text="<i>italic text</i>Nastavi sa kupovinom" CssClass="btn btn-primary" /> 

to render properly. Any clue whether is it feasible?

Upvotes: 0

Views: 211

Answers (1)

johna
johna

Reputation: 10752

Remove your HTML from the Text property and put inside the asp:Button tag, like this:

<asp:Button ID="btnContinueShopping" OnClick="btnContinueShopping_Click" runat="server" CssClass="btn btn-primary"><i>italic text</i>Nastavi sa kupovinom</asp:Button>

Updated:

Sorry, I was mistaken, the Button tag does not support this. But you can use a LinkButton instead, and as you are using Bootstrap, it will look and function the same.

<asp:LinkButton ID="btnContinueShopping" OnClick="btnContinueShopping_Click" runat="server" CssClass="btn btn-primary"><i>italic text</i>Nastavi sa kupovinom</asp:LinkButton>

Upvotes: 1

Related Questions