locked
How to move the search box in the masterpage html file. RRS feed

  • Question

  • Hi

    I have my searchbox kode as follows:

     <!-- ===== STARTER: Search Control ==================================================================================== -->
                                    <div class="ms-dialogHidden">
                                        <!--SPM:<%@Register Tagprefix="SearchWC" Namespace="Microsoft.Office.Server.Search.WebControls" Assembly="Microsoft.Office.Server.Search, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
                                        <!--MS:<SearchWC:SearchBoxScriptWebPart UseSiteCollectionSettings="true" EmitStyleReference="false" ShowQuerySuggestions="false" ChromeType="None" UseSharedSettings="true" TryInplaceQuery="false" ServerInitialRender="true" runat="server">-->
                                            <!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div class="ms-webpart-chrome ms-webpart-chrome-fullWidth "><div WebPartID="00000000-0000-0000-0000-000000000000" HasPers="true" id="WebPart" width="100%" class="ms-WPBody noindex " OnlyForMePart="true" allowDelete="false" style=""><div componentid="ctl00_ctl03_csr" id="ctl00_ctl03_csr"><div id="SearchBox" name="Control"><div class="ms-srch-sb ms-srch-sb-border" id="ctl00_ctl03_csr_sboxdiv"><input type="text" value="Search..." maxlength="2048" accessKey="S" title="Search..." id="ctl00_ctl03_csr_sbox" autocomplete="off" autocorrect="off" onkeypress="EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {if (Srch.U.isEnterKey(String.fromCharCode(event.keyCode))) {$find('ctl00_ctl03_csr').search($get('ctl00_ctl03_csr_sbox').value);return Srch.U.cancelEvent(event);}})" onkeydown="EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {var ctl = $find('ctl00_ctl03_csr');ctl.activateDefaultQuerySuggestionBehavior();})" onfocus="EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {var ctl = $find('ctl00_ctl03_csr');ctl.hidePrompt();ctl.setBorder(true);})" onblur="EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {var ctl = $find('ctl00_ctl03_csr'); if (ctl){ ctl.showPrompt(); ctl.setBorder(false);}})" class="ms-textSmall ms-srch-sb-prompt ms-helperText" /><a title="Search" class="ms-srch-sb-searchLink" id="ctl00_ctl03_csr_SearchLink" onclick="EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {$find('ctl00_ctl03_csr').search($get('ctl00_ctl03_csr_sbox').value);})" href="javascript: {}"><img src="http://sp2013/_layouts/15/images/searchresultui.png?rev=23" class="ms-srch-sb-searchImg" id="searchImg" alt="Search" /></a></div></div></div><noscript><div id="ctl00_ctl03_noscript">It looks like your browser does not have JavaScript enabled. Please turn on JavaScript and try again.</div></noscript><div id="ctl00_ctl03"></div><div class="ms-clear"></div></div></div><!--PE: End of READ-ONLY PREVIEW-->
                                        <!--ME:</SearchWC:SearchBoxScriptWebPart>-->
                                    </div>

    Does anyone know how i could move the location of this searchbox, to for example top right?

    br

    Bjorn

    Wednesday, January 23, 2013 10:22 PM

Answers

  • Well, the first problem is you probably won't be able to use the Design Manager to create an HTML master page to do it. These master pages use a one line ribbon control and you need access to the full ribbon control to inject things into it.

    If you create a custom master page based off of Seattle.master you will see the full ribbon code. Then you can try to move the search box up into the ribbon near <div id="suiteLinksBox">. You'll also need some CSS to style it properly to look right with the suite links.

    The only other option I see is to override the "SuiteLinksDelegate" delegate control, but that would take using Visual Studio to create a new control and a feature to deploy it to the server.


    Randy Drisgill - MVP SharePoint Server
    Rackspace Professional Services for SharePoint
    My Blog: http://blog.drisgill.com
    Coming Soon: Professional SharePoint 2013 Branding & UI Design

    Thursday, January 24, 2013 3:59 PM

All replies