Welcome Guest Search | Active Topics | Sign In | Register

Script error when clicking near CustomItem in menu control Options
Laurynas
Posted: Tuesday, October 26, 2010 4:46:18 AM
Rank: Advanced Member
Groups: Member

Joined: 3/23/2010
Posts: 35
Hello,

When using CustomItem in menu control, mouse click near it throws script error "'null' is null or not an object". I have attached sample page and control source to reproduce this - clicking on gray area around DropDownList raises the error.

~/App_Code/DropDownToolbar.cs:
Code: C#
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DropDown.Toolbars
    {
    /// <summary>
    ///
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class GenericItem<T> : EO.Web.MenuItem, ITemplate
        where T : Control, new ()
        {
        T m_customItem;

        /// &lt;summary&gt;
        /// Initializes a new instance of the &lt;see cref="GenericItem&lt;T&gt;"/&gt; class.
        /// &lt;/summary&gt;
        public GenericItem ()
            {
            this.CustomItem = this;
            }

        /// &lt;summary&gt;
        /// Gets or sets the control.
        /// &lt;/summary&gt;
        /// &lt;value&gt;The control.&lt;/value&gt;
        public virtual T Control
            {
            get
                {
                if (null == m_customItem)
                    m_customItem = new T ();

                return m_customItem;
                }
            protected set
                {
                m_customItem = value;
                }
            }

        #region ITemplate Members

        /// &lt;summary&gt;
        /// When implemented by a class, defines the &lt;see cref="T:System.Web.UI.Control"/&gt; object that child controls and templates belong to. These child controls are in turn defined within an inline template.
        /// &lt;/summary&gt;
        /// &lt;param name="container"&gt;The &lt;see cref="T:System.Web.UI.Control"/&gt; object to contain the instances of controls from the inline template.&lt;/param&gt;
        public virtual void InstantiateIn (Control container)
            {
            container.Controls.Add (Control);
            }

        #endregion
        }

    /// &lt;summary&gt;
    /// 
    /// &lt;/summary&gt;
    public class DropDownListItem : GenericItem<System.Web.UI.WebControls.DropDownList>
        {
        /// &lt;summary&gt;
        /// Initializes a new instance of the &lt;see cref="DropDownListItem"/&gt; class.
        /// &lt;/summary&gt;
        public DropDownListItem ()
            {
            }
        }

    /// &lt;summary&gt;
    ///
    /// &lt;/summary&gt;
    public class LabelItem : GenericItem<LiteralControl>
        {
        /// &lt;summary&gt;
        /// Initializes a new instance of the &lt;see cref="LabelItem"/&gt; class.
        /// &lt;/summary&gt;
        /// &lt;param name="html"&gt;The HTML.&lt;/param&gt;
        public LabelItem (string html)
            {
            this.Control.Text = html;
            }
        }


    /// &lt;summary&gt;
    ///
    /// &lt;/summary&gt;
    public class ViewsList : EO.Web.Menu
        {
        DropDownListItem m_dropDownListItem = new DropDownListItem ();

        /// &lt;summary&gt;
        /// Initializes a new instance of the &lt;see cref="ViewsList"/&gt; class.
        /// &lt;/summary&gt;
        public ViewsList ()
            {
            // This instructs menu to not render last empty td with width set to 99%
            this.TopLevelItemAlign = EO.Web.TopLevelItemAlign.None;
            }

        /// &lt;summary&gt;
        /// Gets the drop down list.
        /// &lt;/summary&gt;
        /// &lt;remarks&gt;The instance for this property is created on first access and may be accessed declaratively.&lt;/remarks&gt;
        /// &lt;value&gt;The drop down list.&lt;/value&gt;
        protected DropDownList DropDownList
            {
            get
                {
                return m_dropDownListItem.Control;
                }
            }

        /// &lt;summary&gt;
        /// Raises the &lt;see cref="E:Init"/&gt; event.
        /// &lt;/summary&gt;
        /// &lt;param name="e"&gt;The &lt;see cref="System.EventArgs"/&gt; instance containing the event data.&lt;/param&gt;
        protected override void OnInit (EventArgs e)
            {
            this.DropDownList.Width = Unit.Percentage (100);
            this.DropDownList.Items.Add ("empty");

            LabelItem labelItem = new LabelItem ("Sample");
            this.Items.Add (labelItem);
            this.Items.Add (m_dropDownListItem);
            base.OnInit (e);
            }
        }

    }


~/dropdown.aspx:
Code: HTML/ASPX


<%@ Page Language="C#" %>

<%@ Register Namespace="DropDown.Toolbars" TagPrefix="dd" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>
        Sample
    </title>
    <style>
        #eo_ele_3
        {
            width:300px;
            background-color:Gray;
            padding:10px;
        }
    </style>
</head>
<body runat="server">
    <form runat="server">

    <div style="clear:both;">
        <dd:ViewsList ID="views" runat="server" />
    </div>

    </form>
</body>
</html>



Thanks,
Laurynas
eo_support
Posted: Tuesday, October 26, 2010 1:57:18 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have confirmed this to be a bug. We will fix it and provide an update build to you as soon as possible.

Thanks!
Laurynas
Posted: Wednesday, November 3, 2010 2:48:38 AM
Rank: Advanced Member
Groups: Member

Joined: 3/23/2010
Posts: 35
Hello,

Is there any progress on this issue?

Thanks,
Laurynas
eo_support
Posted: Wednesday, November 3, 2010 9:26:52 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I believe we have fixed this internally but still need some more time (possibly early next week) for the new build.

Thanks!
eo_support
Posted: Monday, November 8, 2010 12:54:33 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have posted a new build that should resolve this issue. Please see your private message for the download location.

Thanks!
Laurynas
Posted: Tuesday, November 9, 2010 4:46:01 AM
Rank: Advanced Member
Groups: Member

Joined: 3/23/2010
Posts: 35
Thanks, looks like the script error is gone.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.