Click here to Skip to main content
15,886,786 members
Articles / Web Development / ASP.NET

Image and Location Search(aroo)

Rate me:
Please Sign up or sign in to vote.
4.96/5 (28 votes)
11 Jun 2008CPOL12 min read 202.9K   2.5K   76  
Index your website (including images and geographic data), search and display results in Google Earth.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Searcharoo.Common;

namespace Searcharoo.WebApplication
{
    public class SearchControlBase : UserControl
    {
        protected Panel pnlResultsSearch;
        protected Panel pnlHomeSearch;
        protected HtmlGenericControl pHeading;
        protected HtmlTableRow rowSummary, rowFooter1, rowFooter2; 

        /// <summary>Size of the searchable catalog (number of unique words)</summary>
        public int WordCount = -1;

        /// <summary>Word/s displayed in search input box</summary>
        public string Word = "";

        /// <summary>
        /// Error message - on Home Page version ONLY
        /// ie. ONLY when IsSearchResultsPage = true
        /// </summary>
        public string _ErrorMessage;

        /// <summary>Whether the standalone home page version, or the on Search Results page</summary>
        private bool _IsSearchResultsPage;

        /// <summary>Whether the control is placed at the Header or Footer</summary>
        protected bool _IsFooter;

        /// <summary>
        /// Value is either
        ///   false: being displayed on the 'home page' - only thing on the page
        ///   true:  on the Results page (at the top _and_ bottom)
        /// <summary>
        public bool IsSearchResultsPage
        {
            get { return _IsSearchResultsPage; }
            set
            {
                _IsSearchResultsPage = value;
                if (_IsSearchResultsPage)
                {
                    pnlHomeSearch.Visible = false;
                    pnlResultsSearch.Visible = true;
                }
                else
                {
                    pnlHomeSearch.Visible = true;
                    pnlResultsSearch.Visible = false;
                }
            }
        }
        /// <summary>
        /// Footer control has more 'display items' than the one shown
        /// in the Header - setting this property shows/hides them
        /// </summary>
        public bool IsFooter
        {
            set
            {
                _IsFooter = value;
                pHeading.Visible = !_IsFooter;
                rowFooter1.Visible = _IsFooter;
                rowFooter2.Visible = _IsFooter;
                rowSummary.Visible = !_IsFooter;
            }
        }
        /// <summary>
        /// Error message to be displayed if search input box is empty
        /// </summary>
        public string ErrorMessage
        {
            set
            {
                _ErrorMessage = value;
            }
        }
        /// <summary>
        /// Nothing actually happens on the User Control Page_Load () 
        /// ... for now
        /// <summary>
        protected void Page_Load(object sender, EventArgs ea)
        {
        }

        /// <summary>
        /// Was originally used in Searcharoo3.aspx to generate the top and bottom 
        /// search boxes from a single User Control 'instance'. Decided not to use
        /// that approach - but left this in for reference.
        /// <summary>
        [Obsolete("Render control to string to embed mulitple times in a page; but no longer required.")]
        public override string ToString()
        {
            System.IO.StringWriter writer = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter buffer = new System.Web.UI.HtmlTextWriter(writer);
            this.Render(buffer);
            return writer.ToString();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Web Developer
Australia Australia
-- ooo ---
www.conceptdevelopment.net
conceptdev.blogspot.com
www.searcharoo.net
www.recipenow.net
www.racereplay.net
www.silverlightearth.com

Comments and Discussions