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

An introduction to LINQ for db4o

Rate me:
Please Sign up or sign in to vote.
4.77/5 (23 votes)
8 May 2008CPOL17 min read 95K   999   60  
A demo web application for demonstrating the power of LINQ for db4o.
//Author: © Luis Ramirez 2008
//Web site: http://www.sqlnetframework.com
//Creation date: Feb 29, 2008

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace CustomWebControls.GooglePager
{
    /// <summary>
    /// Summary description for ButtonDropDownList
    /// </summary>
    public class ButtonDropDownList : DropDownList, IPostBackEventHandler
    {
        private static readonly object EventCommand = new object();

        public ButtonDropDownList()
        {
            base.AutoPostBack = true;
        }

        public string CommandArgument
        {
            get
            {
                string str = (string)this.ViewState["CommandArgument"];
                if (str != null)
                {
                    return str;
                }
                return string.Empty;
            }
            set
            {
                this.ViewState["CommandArgument"] = value;
            }
        }

        public string CommandName
        {
            get
            {
                string str = (string)this.ViewState["CommandName"];
                if (str != null)
                {
                    return str;
                }
                return string.Empty;
            }
            set
            {
                this.ViewState["CommandName"] = value;
            }
        }

        #region IPostBackEventHandler implementation
        void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
        {
            this.CommandArgument = "0";

            if (base.SelectedItem != null)
                this.CommandArgument = this.SelectedItem.Value;

            this.RaisePostBackEvent(eventArgument);
        }
        #endregion

        protected virtual void OnCommand(CommandEventArgs e)
        {
            CommandEventHandler handler = (CommandEventHandler)base.Events[EventCommand];
            if (handler != null)
            {
                handler(this, e);
            }
            //It bubbles the event to the HandleEvent method of the GooglePagerField class.
            base.RaiseBubbleEvent(this, e);
        }

        protected virtual void RaisePostBackEvent(string eventArgument)
        {
            if (this.CausesValidation)
            {
                this.Page.Validate(this.ValidationGroup);
            }
            this.OnCommand(new CommandEventArgs(this.CommandName, this.CommandArgument));
        }
    }
}

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
Software Developer (Senior) Mirabeau bv
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions