If you want to create a simple site search utility in your web part page.
I found useful link at HERE, Thanks to Josh...
I created a visual web part and added following code
<script language="javascript" type="text/javascript">
function RedirectToSearchResultsPage() {
var searchVal = document.getElementById('SearchTerm').value;
window.location = "searchresults.aspx?k=" + searchVal + "&cs=This Site" + "&u=<%= SPContext.Current.Site.Url %>"; } </script> <div class="listDiv"> <table width="100%"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" class="listTitle-tms"> Search Site </td> </tr> <tr> <td> <input id="SearchTerm" style="width: 70%" /> <input type="button" onclick="RedirectToSearchResultsPage()" value="Search" /> </td> </tr> </table> </td> </tr> </table> </div>
(REMOVE br Tags)
Hope you find it useful.
No comments:
Post a Comment