Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
hi friends,
how to search our asp.net text box value in google search?
If we type some string in that textbox and search that string in google.
 
Thanks & Regards
Hari
Posted 14-Aug-12 7:23am
Comments
Sergey Alexandrovich Kryukov at 14-Aug-12 12:39pm
   
Very unclear, but I can guess what you want. I suspect you don't need to find a text in a search box; you need to read a text from a text box and find this text in Google data, not on your page, right? What's the problem then?
--SA
Sergey Alexandrovich Kryukov at 14-Aug-12 12:42pm
   
Don't you think that to know how to work with Google, you should ask, not too surprising... Google?
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
 
<body><form name="mysearch" action="http://www.google.com/search" method="get" onSubmit="sitesearch(this)">
 
<input id="hiddenquery" type="hidden" name="q" />
<input name="qfront" type="text" style="width: 200px" value="navigator object" /> <input type="submit" value="Search" /><br />
<div style="font: bold 11px Verdana;">Google:<input name="se" type="radio" checked>  Yahoo:<input name="se" type="radio">  MSN:<input name="se" type="radio">
</div>
 
<script type="text/javascript">
 

 
//Enter domain of site to search.
var domainroot="www.codeproject.com/"
 
var searchaction=[ //form action for the 3 search engines
"http://www.google.com/search",
"http://search.yahoo.com/search",
"http://search.msn.com/results.aspx"
]
 
var queryfieldname=["q","p","q"] //name of hidden query form for the 3 search engines

function switchaction(cur, index){
cur.form.action=searchaction[index]
document.getElementById("hiddenquery").name=queryfieldname[index]
}
 
function sitesearch(curobj){
for (i=0; i< document.mysearch.se.length; i++){ //loop through radio to see which is checked
if (document.mysearch.se[i].checked==true)
switchaction(document.mysearch.se[i], i)
}
document.getElementById("hiddenquery").value="site:"+domainroot+" "+curobj.qfront.value
}
 

</script>
 
</p>
 
</form>
 
<p style="font: normal 11px Arial">Search all in one<br />
<a href="http://www.facebook.com/premprakashparihar">prem prakash</a></p>
</body>
</html>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Please see my comment to the question. If this is what you need, it is fully described here:
https://developers.google.com/custom-search/v1/getting_started[^].
 
—SA
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 195
1 Afzaal Ahmad Zeeshan 152
2 ProgramFOX 130
3 Maciej Los 130
4 den2k88 80
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,657
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 14 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100