Crazy Developer

...feel free to become an authority

Welcome to my technical blog. Hope the information enclosed will help you to improve the abilities and resolve the IT issues.
The most popular categories are BlogEngine.NET related info, downloads.
Also, you may be interested by my CV and thesis. Look for more info at About.

hands 

One of the most frequent frustration while quickly adding some code snippets in ASP.Net page is the problem of nested <form> tags forbidding . Thus, you cannot write:

<form id=”form1”…>

   <form id=”form2”…>

   …

   </form>

</form>

Particularly, it is generating problems while adding automatically generated google search box to the master pages of BlogEngine .Net themes. The Google’s code uses the tag <form>. The same tag is used at least for the themes side panel. It means we cannot just put the Google’s code into the side panel. I think it is the reason why I haven’t see the themes having a Google search box. Anyway, a lot of themes having Google ads are present :-)

 

Here I present a solution by presenting a special web control for BlogEngine .Net. Control is replacing the initial standard code, simulating entirely the look&feel and behaviour of standard Google search box. Additionally, Google ads are generated and treated as well.

 

Installation

0. Register with Google Analytics and obtain the javascript scripts of your ads and search box. Extract from scripts and write down the parameters google_ad_client, google_ad_slot and cx (necessary on the step 4.)

1. Download the file GoogleSearchBox.cs.

2. Copy the file into the site to the folder /App_Code/Controls.

3. Rebuild the site, if necessary.

4. Open the site.master file in the theme you use and add where you want the code:

<blog:GoogleSearch ID=”google” runat=”server” Google_ad_client = "pub-4872819432540437" Google_ad_slot = "3391639644" Google_search_box_cx = "partner-pub-0464579479626999:lr8yub7qkzy" />

where Google_ad_client, Google_ad_slot and Google_search_box_cx are the values of parameters google_ad_client, google_ad_slot and cx, extracted from the javascript, generated by Google. Like this one:

<script type="text/javascript"><!--
google_ad_client = "pub-4872819432540437";
/* 468x60,  04.12.09 */
google_ad_slot = "3391639644";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Also here are plenty of additional parameters for additional customizing position of Google controls.

Enjoy!

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Babooo.md 1.5 is the system on top of the site family *.babooo.md, *.babooo.us, *.babooo.ru and *.babooo.eu. It is running on top of MS Windows 2008 tuned up to roles IIS 7.0 and DNS server, SQL Server 2008, Adobe Flash Media Server 3.5 and .Net Framework 3.5.

System components

Mainly it is two major components for now:

1. Crazy Babooo video mail system with video live conferences and chat supporting.

2. Blogs system based on deeply enhanced and customized .Net BlogEngine. You can try Crazy developer Blog, Babooo.md Blog, Personal Alionka blog, Psychology Blog, Sasha Blog, Natasha Blog and so on.

The ongoing development of Babooo.md can be followed at Babooo.md Blog where you can buy the software.

Good luck and enjoy.

The Babooo.md team

Welcome to Babooo.md 1.5

Posted by sirbu