0

How could I add this Bootstrap component code, which is a search bar :

<div class="row">
    <div class="col-lg-6">
        <div class="input-group">
          <input type="text" class="form-control" placeholder="Search for...">
          <span class="input-group-btn">
            <button class="btn btn-default" type="button">Go!</button>
          </span>
        </div><!-- /input-group -->
    </div><!-- /.col-lg-6 -->
</div><!-- /.row -->

In that old asp.net code :

<asp:Panel ID="altHeader3SearchPanel" runat="server" DefaultButton="">                                       
<div class="container-inline" id="search">
    <div class="form-item" id=
    "edit-search-theme-form-1-wrapper">
        <label for=
        "edit-search-theme-form-1">Search this
        site:</label> <asp:textbox class="form-text" id=
        "edit_search_theme_form_1" maxlength="50"
        name="search_theme_form" runat="server" size="15" title=
        "Enter the terms you wish to search for."
        type="text" value="" />
    </div>
    <asp:Button runat="server" ID="edit_submit" CssClass="form-submit" Text="" />

Everything I tried so far gave me an Error Application or Parse Error...

delano
  • 106
  • 1
  • 1
  • 11

1 Answers1

0

You just need to replace html controls with server controls.

FYI: You want to set button control id to DefaultButton, if you want to trigger click event when user presses enter.

<asp:Panel ID="altHeader3SearchPanel" runat="server" DefaultButton="GoButton">
    <div class="row">
        <div class="col-lg-6">
            <div class="input-group">
                <asp:TextBox class="form-control"
                    ID="edit_search_theme_form_1"
                    name="search_theme_form"
                    runat="server"
                    placeholder="Search for..." />
                <span class="input-group-btn">
                    <asp:Button ID="GoButton" runat="server" 
                       CssClass="btn btn-default" Text="Go" />
                </span>
            </div>
        </div>
    </div>
</asp:Panel>
Win
  • 61,100
  • 13
  • 102
  • 181
  • The compilation error is not related to your original question and the code you posted. I could not say what causes the issue. – Win Aug 15 '16 at 20:44
  • Actually, got it to work! Just had to replace the ID's. I have a further question as I need to add Boostrap on the whole app, does the Boostrap code always need to be inside of an asp: tag? – delano Aug 15 '16 at 20:57
  • Not necessarily. If you have a question, please create a new question. I'm gladly take a look at it. – Win Aug 15 '16 at 21:09