Click here to Skip to main content
15,891,739 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
I have a search function where it will search for data in gridview using ajax (search as you type).
What i want to implement next is, lets say if data not found while searching for data,it must get the keyword (entered in the textbox) information from the internet base on google search.

Any ideas how to do this?
Posted

Google has a web service that you can invoke with search parameter to get the search result. Following is a link that shows an example of using the web service and showing the results in a DataList. It shouldn't be hard for you to show the results in a GridView.

See here :

http://www.4guysfromrolla.com/articles/030503-1.aspx[^]

And

http://www.4guysfromrolla.com/articles/030503-1.2.aspx[^]

Best of luck.
 
Share this answer
 
Comments
pwtc222 23-Aug-10 23:51pm    
I m using c-sharp currently
Al-Farooque Shubho 24-Aug-10 0:28am    
Well, converting the VB codes into C# shouldn't be too hard. In fact, you can write your own codes just by seeing the VB codes.

Besides, you can see an example here :http://www.codeproject.com/KB/aspnet/googlewebclient.aspx . This uses a C# code, though, doesn't use a GridView.

The bottom line is, you have to use a Google web service in your application and invoke a web method to get the search result. Binding the search result and showing the result in a control shouldn't be a too big problem.

You can have a look at some GridView quick starts here : http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gridview.aspx
Hi.
I m almost there.The code is here at behind:

C#
protected void Button1_Click(object sender, EventArgs e)
        {
          Response.Redirect("http://www.google.com/search?hl=en&q=" + TextBox1.Text.ToString() + "");  // TextBox1.Text contains the  text  entered  by  the  user
        }


But i have one problem with it.The keyword entered in the textbox search in google,but it load a as a new page in browser.I want the exact page to be loaded in iframe when click the button.

Any ideas?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900