How to implement Google search engine

Topics: ASP.NET 2.0, Business Logic Layer, Themes
Jul 18, 2010 at 6:49 PM

Hi,

I want to implement google search engine in my BE. For this add code in side panel (I3 Theme). But when I tried to login after implement this, BE return 404 error.  And if I implement this code into my master page, Sign In button is not working.  I could not understand why it's happening?  Kindly suggest me What should I do?  For Search box my script look like this :-

 

<form action="http://www.myelibrary.net/GoogleSearch.aspx" id="cse-search-box"  style ="position: absolute;top: 0px; right: 0px; "> 
  <div style ="position: absolute; top: 0px; right: 0px; background: url(images/searchform-bg2.png) no-repeat right bottom; height: 55px;width: 210px;">
    <input type="hidden" name="cx" value="partner-pub-XXXXXXXXXXX" />
    <input type="hidden" name="cof" value="....." />
    <input type="hidden" name="ie" value="....." />
    <input type="text" name="q" size="28"  />
    <input type="submit" name="sa" value="Search" />
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script>

 

Any help would be highly appreciable.

 

 

Jul 19, 2010 at 5:56 AM
From:Kishan

I am not sure just a guess. Try to remove the <form> tag your sign in problem will be solved.

Thanks


Make the world eco-friendly through MSN Green Drag n' drop
Jul 19, 2010 at 7:10 PM

This script has been provided by Google. so it's not possible to remove this.  Could you please suggest any othet trick?

Jul 19, 2010 at 7:57 PM

I got the problem.  Actually I was using This form tag into master form tag (Nested form tag) and I think then it is not allowing to post back.  I have written it outside and now code is working fine :)

Aug 1, 2010 at 6:09 PM

I also face the same problem to add the google search box. I solved this problem by placing the google search box in master page in iframe. The details are written in this article.

http://www.ravinderweb.com/page/Add-Googel-search-box.aspx

Jan 12, 2011 at 10:23 AM
Edited Jan 12, 2011 at 3:40 PM

I add new tag form to my site.master

 

<form id="cse-search-box" action="http://silverlightvn.net/searchresult.aspx">

<div style="position:absolute; left:620px; width:310px; top: 155px;">
<input type="hidden" name="cx" value="partner-pub-XXXXXXXXXXX" />
<input type="hidden" name="cof" value="....." />
<input type="hidden" name="ie" value="....." />
<input type="text" name="q" size="28" />
<input type="submit" name="sa" value="Search" />
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=vi"></script>

<form runat="Server" class="body">

<div id="content0">
<asp:ContentPlaceHolder ID="cphBody" runat="server" />
</div>

</form>

 

similar with SearchResult.aspx

 

<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 980;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>

You can view the result at http://silverlightvn.net