<p>Google custom search code is provided as a form tag. However, Asp.net only allows a single form tag on a page. What is the best way to implement their code so you can include it on an aspx page (say as part of a Masterpage or navigation element). </p>


  
    
    
    
    
    
  




[{'answer_id': 75234, 'author': 'Chris Van Opstal', 'author_id': 7264, 'author_profile': 'https://Stackoverflow.com/users/7264', 'pm_score': 3, 'selected': False, 'text': '<p>You can have multiple form tags on an ASP.NET page. The limitation is on server-side (runat="server") form tags. </p>\n\n<p>You can implement two form tags (or more) as long as only one has the runat="server" attribute and one is not contained in the other. Example:</p>\n\n<pre><code>&lt;body&gt;\n&lt;form action="http://www.google.com/cse" id="cse-search-box"&gt; ... &lt;/form&gt;\n&lt;form runat="server" id="aspNetform"&gt; ... &lt;/form&gt;\n&lt;body&gt;\n</code></pre>\n'}, {'answer_id': 75288, 'author': 'Eric Longman', 'author_id': 13282, 'author_profile': 'https://Stackoverflow.com/users/13282', 'pm_score': 2, 'selected': False, 'text': '<p>You may be able to have multiple form tags, but note that they cannot be nested.  You\'ll run into all kinds of weirdness in that scenario (e.g., I\'ve seen cases where the opening tag for the nested form apparently gets ignored and then its closing tag winds up closing the "parent" form out).  </p>\n'}, {'answer_id': 75380, 'author': 'Timothy Lee Russell', 'author_id': 12919, 'author_profile': 'https://Stackoverflow.com/users/12919', 'pm_score': 0, 'selected': False, 'text': '<p>You could use Javascript:</p>\n\n<pre><code>&lt;input name="Query" type="text" class="searchField" id="Query" value="Search" size="15" onfocus="if(this.value == \'Search\') { this.value = \'\'; }" onblur="if(this.value == \'\') { this.value = \'Search\'; }" onkeydown="var event = event || window.event; var key = event.which || event.keyCode; if(key==13) window.open(\'http://www.google.com/search?q=\' + getElementById(\'Query\').value ); " /&gt;&lt;input name="" type="button" class="searchButton" value="go" onclick="window.open(\'http://www.google.com/search?q=\' + getElementById(\'Query\').value );" /&gt;\n</code></pre>\n'}, {'answer_id': 767329, 'author': 'sean', 'author_id': 82371, 'author_profile': 'https://Stackoverflow.com/users/82371', 'pm_score': 1, 'selected': False, 'text': '<p>You\'ll need to remove the form tag and use javascript send the query. Have a look at \n<a href="http://my6solutions.com/post/2009/04/19/Fixing-Google-Custom-Search-nested-form-tags-in-asp-net-pages.aspx" rel="nofollow noreferrer">http://my6solutions.com/post/2009/04/19/Fixing-Google-Custom-Search-nested-form-tags-in-asp-net-pages.aspx</a></p>\n\n<p>I have included the before and after code as well. So you can see what I\'ve done to integrate it with blogengine .net.</p>\n'}]
['https://Stackoverflow.com/questions/75139', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']