Bootstrap on asp.net button

Is there a way that I can bind bootstrap to asp controls?

Bootstrap Button:

       <button type="button" class="btn btn-default btn-lg">
  <span class="glyphicon glyphicon-cog"></span></button>

      

Asp.net button:

    <asp:Button ID="Button1" runat="server" Text="Button" class="btn btn-default btn-lg"/>//How i add the span class? or is there a work around?

      

If this is not possible, is there a way the html button can trigger the .net eventfunction?

protected void Button1_Click(object sender, EventArgs e)
    {
        //Do something.
    }

      

I tried adding onclick = "Button1_Click" to html, it doesn't work.

+3


source to share


1 answer


You can use <asp:LinkButton>

to add an icon to a button. eg.



<asp:LinkButton ID="CogLinkButton" CssClass="btn btn-default btn-lg" runat="server" OnClick="CogLinkButton_Click"><span class="glyphicon glyphicon-cog"></span></asp:LinkButton>

      

+8


source







All Articles