Quick Search
Quick Search helps you search for any location; this is useful when running Local Knowledgeâ„¢ searches. and displaying search results on the SIS Notice Board website.
Including a search in a web page is quite straightforward. Here are the steps:
TIP: See index.html file (located in C:\inetpub\wwwroot\NoticeBoard9\EmbeddedSearchSample) for more information on an embeddable search.
1. Add code to point to your Notice Board site
a. Begin by opening the web page in a text editor. This is the page on which you want the search control.
b. Use the following line of code to point to your instance of Cadcorp SIS Notice Board 9.
<script src="http://YOURSERVER/YOURWEBSITE/GetSearch.axd? embeddedControlId=mySearch&controlTagId=searchPlaceholderTag &showgeolocate=true¬iceboardUrl=http://YOURSERVER/YOURWEBSITE/noticeboard.aspx" type="text/javascript"></script>
A note on the Search function
When using Quick Search you, the user, will define the function (i.e. what should happen when search results are displayed and when one of them is selected)
This is done using the searchSelectHandler:
In this example, the function passed to the Handler is EmbeddedMap.resultSelectedHandler.
This function is called when you select a location
and you receive data about the location. For more help, contact Cadcorp Technical Services
The website embedding the search bar AND the Notice Board website MUST be in the same domain.
2. Edit the web.config file
- Open web.config in a suitable text editor.
- You can find the config file in C:\inetpub\wwwroot\NoticeBoard9
- Navigate to the <system.webServer> section and add this code snippet.
<add name="getsearch" verb="GET" path="GetSearch.axd" type="Cadcorp.Web.UI.Controls.NoticeBoard.EmbeddedSearch.EmbeddedSearchHandler, Cadcorp.Web.UI" />
There are two mandatory parameters that must be added to the URL:
- controlTagId: This is the id of the element that the search bar will be added to (for example to add the search bar to this element:)
<div id="SearchElement"></div>
- Here the controlTagID is SearchElement
- embeddedControlId: This is the id of the search bar; it must be unique.
There are other parameters that can be added to the URL to customise the search bar behaviour.
- delay: The delay in milliseconds that the search bar will wait after you have finished typing until a search is performed.
- showgeolocate: Set to true to show the geolocate button. If geolocate is not required omit it or set it to false.
- noticeboardUrl: The url to the Cadcorp Notice Board application. This must be encoded.
- initialamountofresultstofetch: The amount of results that will be retrieved when the search is first performed.
- extraresultstofetch: The amount of results to fetch when the More button is clicked.
Finally if the website with the embedded search and the Cadcorp SIS Notice Board 9 website are on different domains, edit the web.config.
At the end of web.config there is a block of code commented out by default:
<!-- Allow Cross Origin Resource Sharing (cors) for QuickSearch.asmx--> <!-- <location path="QuickSearch.asmx"> <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> <add name="Access-Control-Request-Method" value="GET,POST,OPTIONS" /> <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" /> </customHeaders> </httpProtocol> </system.webServer> </location> -->
Remove the comment, i.e. delete <!-- from <!-- <location and --> from the closing </location> -->