Wednesday, August 25, 2010

How to add google custom search to your page with Master Page

Master page
<%@ Master Language="C#" %>
<html xmlns="" xml:lang="en">
<head id="Head2" runat="server">
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    <script runat="server">
        public string RootUrl
                Uri requestUri = Context.Request.Url;
                HttpRequest request = Context.Request;
                string rootUrl = string.Format("{0}{1}{2}{3}{4}",
                    requestUri.IsDefaultPort ?
                        string.Empty : string.Format(":{0}", requestUri.Port),
                return rootUrl.EndsWith("/") ? rootUrl :
                        string.Format("{0}/", rootUrl);
    <form id="Form2" runat="server">
        <div id="search">
                src="<%=this.RootUrl %>Search.html" 
                <b>Your browser does not support frames</b>
        <asp:ContentPlaceHolder ID="MainContent" runat="server" />  
Search html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns="" >
    <style type="text/css">
    <form target="_blank" id="searchForm" method="get" action="">
        <span id="searchText"><em>Search</em></span>
        <input id="searchInput" type="text" name="q" title="Search" />
        <input id="searchButton" type="submit" value="Search" title="Search" />
  <input type="hidden" name="domains" value="" />
  <input type="hidden" name="sitesearch" value="" />        

No comments:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...