Twitter Bootstrap Button Display In ASP

I noticed a problem with my buttons within an ASP page within the Twitter Bootstrap. It seems the only class that appears correctly is the "btn" class. If I would like to use "btn btn-primary" a grey gradient appears over my blue button. When I hover over the button it half of it turns blue. I've tried it with the other button styles and I get the same result.

I'm hoping the code below is correct:

<asp:button type="button" id="btnSearch" runat="server" CssClass="btn btn-primary" Text="Search"></asp:button> 

Full HTML

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="header.aspx.vb" Inherits="Backend.header" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title></title>


<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="css/bootstrap-responsive.css" />
<link rel="stylesheet" href="css/custom.css" />

</head>
<body>
<form id="masterSearch" runat="server">
    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
          <div class="container">
              <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
              </a>

              <a class="brand" href="#">Company Name</a>

              <div class="nav-collapse collapse">
                  <ul class="nav">
                      <li><a href="cart.aspx">
                          <asp:Label ID="Label1" runat="server" Text="Cart"> </asp:Label></a></li>
                      <li class="dropdown">
                          <a href="#" class="dropdown-toggle" data-toggle="dropdown">History <b class="caret"></b></a>
                          <ul class="dropdown-menu">
                              <li><a href="#">New Order</a></li>
                              <li><a href="#">Order History</a></li>
                          </ul>
                      </li>
                      <li><a href="#">Invoices</a></li>
                      <li class="dropdown">
                          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Returns <b class="caret"></b></a>
                          <ul class="dropdown-menu">
                              <li><a href="#">Return Previous Order</a></li>
                              <li><a href="#">Return Policy</a></li>
                          </ul>
                      </li>
                      <li><a href="#">Rewards Balance</a></li>
                      <li><a href="#">Help</a></li>
                      <li><a href="#">Log Out</a></li>
                  </ul>
              </div>
          </div>
      </div>
    </div>

    <div id="wrap">
            <div class="row-fluid">

         <div class="container">

             <div class="span12">
                 <asp:Label ID="Label1" class="pull-right" runat="server" Text="Label"></asp:Label>
              </div>

       </div> <!--/container-->
   </div> <!--/row-->

    <hr />

    <div class="container">
        <div class="row-fluid">
            <div class="span2">Left Column</div><!--/left sidebar-->

            <div class="span8">
                <h5 class="pagination-centered">Search By...</h5>
                <div class="span12">

                        <input type="text" id="txtSearch1" placeholder="NDC#, Item#, Item Name..." runat="server" />
                        <asp:button type="button" id="btnSearch" runat="server" CssClass="btn btn-primary" Text="Search"></asp:button>       


                </div> <!--/search-->

                <div class="searchResults">
                    <table ID="tblSearchResults" class="table table-bordered">
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
                             <Columns>


                                       <asp:BoundField HeaderText="Generic" DataField="ItemDesc" />
                                       <asp:BoundField HeaderText="Brand" DataField="BrandName" />
                                        <asp:BoundField HeaderText="Item Number" DataField="ItemNumber" />
                                        <asp:BoundField HeaderText="NDC" DataField="NDC" />
                                       <asp:BoundField HeaderText="Class" DataField="ControlLevel" />
                                        <asp:BoundField HeaderText="Price" DataField="Price" />
                                        <asp:TemplateField HeaderText="Qty">




                    <ItemTemplate>
                        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                    </ItemTemplate>
                </asp:TemplateField>
                             </Columns>
        </asp:GridView> 


                </table>

                </div>


            </div><!--/main content -->

            <div class="span2">Right Column</div><!--/right sidebar-->
        </div><!--/row-->

    </div> <!--/container -->












     <asp:button type="button" id="btnAdd" class=" btn btn-danger" runat="server" Text="Add to Cart"></asp:button> 
&nbsp;&nbsp;
    <asp:Button ID="btnCheckOut" runat="server" Text="Check Out" />






    </form>
   </body>
  </html>

I don't necessarily remember 100% but after thinking about this a bit more, I think I ran into the same exact thing as you. In looking at some of my old code, I worked around this by using the Link Button instead of the Button control.

<asp:LinkButton CssClass="btn btn-small" runat="server" ID="m_ReportButton" OnClick="OnReportClick" Text="Report" />
<asp:LinkButton CssClass="btn btn-small" runat="server" ID="m_DeleteButton" OnClick="OnDeleteClick" Text="Delete" />
<asp:LinkButton CssClass="btn btn-small" runat="server" ID="m_EditButton" OnClick="OnEditClick" Text="Edit" />
<asp:LinkButton CssClass="btn btn-small" runat="server" ID="m_QuoteButton" OnClick="OnQuoteClick" Text="Quote" />
<asp:LinkButton CssClass="btn btn-small" runat="server" ID="m_ReplyButton" OnClick="OnReplyClick" Text="Reply" />

Thinking back I am almost certain I made this change simply to apply more than just the btn bootstrap class.

链接地址: http://www.djcxy.com/p/75964.html

上一篇: Twitter引导响应块高度

下一篇: Twitter中的引导按钮显示在ASP中