Search In Asp.Net
Introduction:
In this article we will see how to implement search facility in our Asp.Net web-site.
Background:
On forum I’ve seen some search question. Means they want to Implement search in their Asp.Net. Yes we can implement such search facility in our Asp.Net web-site for searching particular word on page. For this task I’m using some third party control which provide search box and search result two control for this operation.
Keyoti.com provide such control. Download trial version of Search For Asp.Net from given link http://www.keyoti.com/products/search/dotnetweb/index.html. Once you download the control it will give some setup file to you. Now we will see some installation step bellow.
Installation Of Search In Asp.Net:
Step 1:
Run the setup downloaded.
Step 2:
Follow step-by-step installation as like other product installation you do. When that installation will ask you to which .Net version Search Control you want to install specify the version you are using it will give three option to you.
1) CLR 1.0/1.1
2) CLR 3.0/3.5
3) CLR 4.0
Select your version from above given option by checking checkbox of your version you can install that three option also if you have install Visual Studio 2003/05/08/10. For installation you must need the internet connection. Follow I’ve given some screens if you are facing any problem follow the option selection given in the screens.
Step 1:
Select Search Pro option given in following screen.
Step 2:
Select version shown in given screen bellow. Next two step are for installation of the control on LAN.
Step 3:
Finally the setup will ask you to add the control in Visual Studio Select version of your VS which you commonly use. It will add two controls to your Visual Studio but for this you must need closed all Visual Studio Instances. Follow this final screen for adding this control to your visual Studio.
Step 4:
Now you can use this control on any .aspx page. Add SearchBox control to your Asp.Net page which give you one TextBox and One Button for search. This SearchBox Contain smart tag which will ask you a Result Page Url Specify the Result Page URL in this Smart tag. This URL normally is the URL of that page where second control i.e Search Result you have taken.
Step 5:
Now first prepare our Result Page to show the result. In same page also you can do it just bellow SearchBox keep SearchResult control and give this SearchResult Control URL in SearchBox smarttag as explain in Step 5.
Step 6:
This SearchResult control contain one smart tag which will ask you to manage Index Directory. If you select Directory specified by this SearchResult Control it will create IndexDirectory in your rood Directory of project.
Step 7:
This index directory will manage all URL’s and If you want to perform search in Database then some queries and some connection to DataBase. If you want to perform search only on webpage then simply add the URL’s on which you want to search. Follow given screen will give you Idea how to specify the URL’s. In following screen click on Import Documents/records button it will show one another screen for specifying URL’s or DataBase queries and connection.
Step 8:
Now run your project and type your query in SearchBox and Click on Search button and see the result is shown to you from the specified URL’s which contain your word.
Conclusion:
In this way you can customize search facility to your Asp.Net web-site.