Welcome Guest Search | Active Topics | Sign In | Register

EO objects in Composite Control Options
Budz
Posted: Thursday, April 17, 2008 8:47:52 AM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
I am creating a composite control that is a DropDownList that uses an EO ContextMenu and three EO CustomItems.

In my CreateChildControls(), after doing Controls.Clear(), I create the following items in order:

- DropDownList
- TextBoxes, Buttons and Tables which will become child controls of the EO CustomItems
- the three EO CustomItems (to whose control collections I add the tables created above)
- three EO MenuItems (that are linked to the custom items and will be set as sub menu items)
- three more EO MenuItems (that will become top-level menu items in the ContextMenu)
- one EO ContextMenu
- then I set up the ContextMenu styles
- then I add the LookItems to the ContextMenu
- then I add the top-level items to the ContextMenu
- then I add the sub-menu items to the ContextMenu
- lastly I add the DropDownList, CustomItems and ContextMenu to this.Controls

In my RenderContents(), I use an HtmlTextWriter to render the DropDownList, CustomItems and ContextMenu.

Now, onto the issue I'm having...

When I compile the control, add it to my ToolBox, drop it onto a page, configure its settings and run the page, it works fine -- as long as there is some other EO object on the page ABOVE my composite control. If there are no EO objects on the page above my composite control, the DropDownList loads, but I don't get any context menu (or, hence, any CustomItems in sub-menus).

Clicking the little error icon at the bottom-left of the Internet Explorer 7 window shows me the following errors:

- First: "'this.ara' is null or not an object"
- Second: "Object doesn't support this property or Method"
- Third: "'this.aqw.any' is null or not an object" (this third error doesn't always appear)

It seems to me that when there is another EO object on the page BEFORE my composite control, something gets initialized -- allowing my control to work -- that doesn't get initialized otherwise.

Whatever the case is, what suggestions do you have?

If you would like to see some of the code, let me know. I am going to work on creating something similar (and much smaller *S*) in the hopes of recreating the issue so I can post it here and have it be more readable.

Thank you!
Allen
eo_support
Posted: Thursday, April 17, 2008 8:52:10 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,093
Hi Allen,

Try to initialize all our controls in your OnInit method. That way it gets initialized early. They won't work when they are initialized too late.

Thanks
Budz
Posted: Thursday, April 17, 2008 11:58:42 AM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
You said => "...initialize all our controls in your OnInit method..."

Are you referring to the OnInit method of the composite control itself? Are you talking about putting some line into the OnInit of my control? As in:

public class DropComposite : CompositeControl, INamingContainer
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
...
... // EO control initialization goes here
...
}
...
... // other code here
...
}

If this is what you mean, assuming an EO ContextMenu control named 'mnu', what would I put where the control initialization would go?

Allen
Budz
Posted: Thursday, April 17, 2008 12:03:11 PM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
By the way, for what it's worth, I ran this with just the basic OnInit() in my control as such:

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}

... and put a breakpoint on the openning curly bracket '{' of the OnInit. At this point, all the EO controls had apparently been instantiated. When I type 'mnu' in the Immediate window, I get:

{EO.Web.ContextMenu}
base {EO.Web.Menu}: {EO.Web.ContextMenu}
ContextControlID: "DropCompositeVS1"

Allen
eo_support
Posted: Thursday, April 17, 2008 12:12:32 PM
Rank: Administration
Groups: Administration

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

Yes. Overriding OnInit and do whatever you do in your CreateChildControls there is what we meant. The goal is to do whatever you do inside your CreateChildControls (which might be the same or different than merely instantiate the control) at the early stage of the page life cycle. By default CreateChildControls is called rather late in the page life cycle.

Thanks
Budz
Posted: Thursday, April 17, 2008 12:25:26 PM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
I went ahead and just put a call to CreateChildControls() in my control's OnInit() method and it's still behaving the same way -- if I have my control on a page and there is not an EO control on the page before it, the EO controls don't render.

They seem to be there -- if I set a breakpoint and look at the custom control through the immediate window, I can drill down to the various child controls which includes the EO controls. They just won't appear for me.

Allen
eo_support
Posted: Thursday, April 17, 2008 12:44:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,093
Hi Allen,

Theoratically there is no difference between creating our controls by code and creating them declaratively in your .aspx/.ascx, because ASP.NET generates code based on your .aspx/.ascx and then run the code --- which means everything is always dynamically created by code. The only difference is whether the code is automatically generated by ASP.NET or hand-written by you. So the issue may not have anything to do with composite control at all.

The only other things we can think of is, if you use an AJAX solution other than ours to dynamically load the composite control itself, then you can run into this problem. This case would have nothing to do with composite control. The following steps would reproduce the issue:

1. Place an ASP.NET AJAX UpdatePanel in the page;
2. Place an eo:Menu inside UpdatePanel;
3. Set the menu's Visible to false so that it is not visible after first load;
4. Place a button inside the UpdatePanel;
5. Handle the button's click event, inside the event handler set the menu's Visible to true;

This will not work because our JavaScript did not "join the party" from the very begining. Our controls works with ASP.NET AJAX well but we have to be present before the AJAX call. The solution is to place another eo control (any control will do) outside of the UpdatePanel so that we are in before the AJAX call. In this case what you have observed is actually the recommended solution. We usually recommend you to place an empty eo:CallbackPanel in the page because it is relatively light-weight and do not render anything visible.

Thanks
Budz
Posted: Friday, April 18, 2008 8:44:37 AM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
Okay... here is another interesting twist on this issue.

I've written a much smaller control that includes an ordinary TextBox with a couple properties changed, an EO ContextMenu, and six EO MenuItems -- three to be used as top-level items and three to be used as sub-menu items. (Also, there are three more EO.MenuItems to be used as LookItems.)

When I drop this onto an aspx page by itself, it behaves as expected with no problems.

THEN... I added three EO CustomItems to the control and set my sub-menus' CustomItemID one to each respectively. I added the CustomItems to the control (along with the TextBox and the ContextMenu) and render all five objects (the TextBox, three CustomItems and the ContextMenu).

When I drop the control that now includes CustomItems onto an aspx page by itself, I do not get any context menu upon right-clicking the control and I get the errors (via IE7) as noted above ('this.ara' is null or not an object, & object doesn't support this property or method, & 'this.aqw.any' is null or not an object).

So, this seems to me to be an issue within the CustomItems. Below is the text of my controls.

First, the one without CustomItems that Does work:

Code: C#
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Configuration;
using System.ComponentModel;
using System.Security.Permissions;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DropDownListComposite
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:EOTestControl runat=server></{0}:EOTestControl>")]
    public class EOTestControl : CompositeControl, INamingContainer
    {
        // -------------------------------------- CREATE CONTROLS TO BUILD COMPOSITE
        private TextBox incoming;
        // -------------------------------------- SUB-MENU ITEMS FOR CONTEXT MENU
        private EO.Web.MenuItem mAddSub;
        private EO.Web.MenuItem mEditSub;
        private EO.Web.MenuItem mDeleteSub;
        // -------------------------------------- MENU ITEMS FOR CONTEXT MENU
        private EO.Web.MenuItem mAdd;
        private EO.Web.MenuItem mEdit;
        private EO.Web.MenuItem mDelete;
        // -------------------------------------- EO CONTEXT MENU
        private EO.Web.ContextMenu mnu;


        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public string Text
        {
            get
            {
                String s = (String)ViewState["Text"];
                return ((s == null) ? String.Empty : s);
            }

            set
            {
                ViewState["Text"] = value;
            }
        }

        protected override void RecreateChildControls()
        {
            EnsureChildControls();
        }

        protected override void CreateChildControls()
        {
            Controls.Clear();
            // ---------------------------------- SET UP TEXT BOX
            incoming = new TextBox();
            incoming.ID = "incoming";
            incoming.BackColor = Color.Black;
            incoming.ForeColor = Color.Yellow;

            // ---------------------------------- SET UP SUB-MENU ITEM 'ADD'
            mAddSub = new EO.Web.MenuItem();
            mAddSub.Text.Html = "add";
            // ---------------------------------- SET UP SUB-MENU ITEM 'EDIT'
            mEditSub = new EO.Web.MenuItem();
            mEditSub.Text.Html = "edit";
            // ---------------------------------- SET UP SUB-MENU ITEM 'DELETE'
            mDeleteSub = new EO.Web.MenuItem();
            mDeleteSub.Text.Html = "delete";

            // ---------------------------------- SET UP MENU ITEM 'ADD'
            mAdd = new EO.Web.MenuItem();
            mAdd.Text.Html = "Add";
            // ---------------------------------- SET UP MENU ITEM 'EDIT'
            mEdit = new EO.Web.MenuItem();
            mEdit.Text.Html = "Edit";
            // ---------------------------------- SET UP MENU ITEM 'DELETE'
            mDelete = new EO.Web.MenuItem();
            mDelete.Text.Html = "Delete";

            // ---------------------------------- SET UP CONTEXT MENU
            mnu = new EO.Web.ContextMenu();
            mnu.ContextControlID = this.ID; // set the controlID of the context menu to the edittable drop down list
            // ---------------------------------- SET UP CONTEXT MENU TEMPLATE
            mnu.Width = Unit.Pixel(300);
            mnu.ControlSkinID = "None";

            EO.Web.MenuItem TopLevelItem = new EO.Web.MenuItem();
            TopLevelItem.HoverStyle.CssText = "color:#F7B00A;padding-left:5px;padding-right:5px;";
            TopLevelItem.ItemID = "_TopLevelItem";
            TopLevelItem.NormalStyle.CssText = "padding-left:5px;padding-right:5px;";
            TopLevelItem.SubMenu.ItemSpacing = 5;
            TopLevelItem.SubMenu.OffsetX = -3;
            TopLevelItem.SubMenu.OffsetY = 3;
            TopLevelItem.SubMenu.ShadowDepth = 0;
            TopLevelItem.SubMenu.Style.CssText = "border-right: #e0e0e0 1px solid; padding-right: 3px; border-top: #e0e0e0 1px solid; padding-left: 3px; font-size: 12px; padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #5f7786; padding-top: 3px; border-bottom: #e0e0e0 1px solid; font-family: arial; background-color: #f7f8f9";

            EO.Web.MenuItem Separator = new EO.Web.MenuItem();
            Separator.IsSeparator = true;
            Separator.ItemID = "_Separator";
            Separator.NormalStyle.CssText = "width: 1px; height: 1px; background-color:#e0e0e0;";

            EO.Web.MenuItem Default = new EO.Web.MenuItem();
            Default.HoverStyle.CssText = "color:#F7B00A;padding-left:5px;padding-right:5px;";
            Default.ItemID = "_Default";
            Default.NormalStyle.CssText = "padding-left:5px;padding-right:5px;";
            Default.SubMenu.ItemSpacing = 5;
            Default.SubMenu.OffsetX = 3;
            Default.SubMenu.OffsetY = -4;
            Default.SubMenu.ShadowDepth = 0;
            Default.SubMenu.Style.CssText = "border-right: #e0e0e0 1px solid; padding-right: 3px; border-top: #e0e0e0 1px solid; padding-left: 3px; font-size: 12px; padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #5f7786; padding-top: 3px; border-bottom: #e0e0e0 1px solid; font-family: arial; background-color: #f7f8f9";

            // ---------------------------------- ADD THE LOOK ITEMS TO THE CONTEXT MENU
            mnu.LookItems.Add(TopLevelItem);
            mnu.LookItems.Add(Separator);
            mnu.LookItems.Add(Default);

            // ---------------------------------- ADD TOP LEVEL ITEMS TO CONTEXT MENU
            mnu.TopGroup.Items.Add(mAdd);
            mnu.TopGroup.Items.Add(mEdit);
            mnu.TopGroup.Items.Add(mDelete);
            
            // ---------------------------------- ADD SUB-ITEMS TO CONTEXT MENU
            mnu.TopGroup.Items[0].SubMenu.Items.Add(mAddSub);
            mnu.TopGroup.Items[1].SubMenu.Items.Add(mEditSub);
            mnu.TopGroup.Items[2].SubMenu.Items.Add(mDeleteSub);

            // ---------------------------------- ADD THE CONTROLS
            this.Controls.Add(incoming);
            this.Controls.Add(mnu);
        }

        protected override void RenderContents(HtmlTextWriter output)
        {
            // ---------------------------------- RENDER BASIC CONTROL (TEXT BOX)
            incoming.RenderControl(output);
            // ---------------------------------- RENDER CONTEXT MENU
            mnu.RenderControl(output);
        }
    }
}


Then, the control With the CustomItems that does Not work:

Code: C#
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Configuration;
using System.ComponentModel;
using System.Security.Permissions;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DropDownListComposite
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:EOTestControl2 runat=server></{0}:EOTestControl2>")]
    public class EOTestControl2 : CompositeControl, INamingContainer
    {
        // -------------------------------------- CREATE CONTROLS TO BUILD COMPOSITE
        private TextBox incoming;
        // -------------------------------------- CUSTOM ITEMS FOR CONTEXT MENU
        private EO.Web.CustomItem itemAdd;
        private EO.Web.CustomItem itemEdit;
        private EO.Web.CustomItem itemDelete;
        // -------------------------------------- SUB-MENU ITEMS FOR CONTEXT MENU
        private EO.Web.MenuItem mAddSub;
        private EO.Web.MenuItem mEditSub;
        private EO.Web.MenuItem mDeleteSub;
        // -------------------------------------- MENU ITEMS FOR CONTEXT MENU
        private EO.Web.MenuItem mAdd;
        private EO.Web.MenuItem mEdit;
        private EO.Web.MenuItem mDelete;
        // -------------------------------------- EO CONTEXT MENU
        private EO.Web.ContextMenu mnu;


        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public string Text
        {
            get
            {
                String s = (String)ViewState["Text"];
                return ((s == null) ? String.Empty : s);
            }

            set
            {
                ViewState["Text"] = value;
            }
        }

        protected override void RecreateChildControls()
        {
            EnsureChildControls();
        }

        protected override void CreateChildControls()
        {
            Controls.Clear();
            // ---------------------------------- SET UP TEXT BOX
            incoming = new TextBox();
            incoming.ID = "incoming";
            incoming.BackColor = Color.Black;
            incoming.ForeColor = Color.Yellow;

            // ---------------------------------- SET UP CUSTOM ITEM 'ADD'
            itemAdd = new EO.Web.CustomItem();
            itemAdd.ID = "itemAdd";

            // ---------------------------------- SET UP CUSTOM ITEM 'EDIT'
            itemEdit = new EO.Web.CustomItem();
            itemEdit.ID = "itemEdit";

            // ---------------------------------- SET UP CUSTOM ITEM 'DELETE'
            itemDelete = new EO.Web.CustomItem();
            itemDelete.ID = "itemDelete";

            // ---------------------------------- SET UP SUB-MENU ITEM 'ADD'
            mAddSub = new EO.Web.MenuItem();
            mAddSub.Text.Html = "add";
            mAddSub.CustomItemID = "itemAdd";
            // ---------------------------------- SET UP SUB-MENU ITEM 'EDIT'
            mEditSub = new EO.Web.MenuItem();
            mEditSub.Text.Html = "edit";
            mEditSub.CustomItemID = "itemEdit";
            // ---------------------------------- SET UP SUB-MENU ITEM 'DELETE'
            mDeleteSub = new EO.Web.MenuItem();
            mDeleteSub.Text.Html = "delete";
            mDeleteSub.CustomItemID = "itemDelete";

            // ---------------------------------- SET UP MENU ITEM 'ADD'
            mAdd = new EO.Web.MenuItem();
            mAdd.Text.Html = "Add";
            // ---------------------------------- SET UP MENU ITEM 'EDIT'
            mEdit = new EO.Web.MenuItem();
            mEdit.Text.Html = "Edit";
            // ---------------------------------- SET UP MENU ITEM 'DELETE'
            mDelete = new EO.Web.MenuItem();
            mDelete.Text.Html = "Delete";

            // ---------------------------------- SET UP CONTEXT MENU
            mnu = new EO.Web.ContextMenu();
            mnu.ContextControlID = this.ID; // set the controlID of the context menu to the edittable drop down list
            // ---------------------------------- SET UP CONTEXT MENU TEMPLATE
            mnu.Width = Unit.Pixel(300);
            mnu.ControlSkinID = "None";

            EO.Web.MenuItem TopLevelItem = new EO.Web.MenuItem();
            TopLevelItem.HoverStyle.CssText = "color:#F7B00A;padding-left:5px;padding-right:5px;";
            TopLevelItem.ItemID = "_TopLevelItem";
            TopLevelItem.NormalStyle.CssText = "padding-left:5px;padding-right:5px;";
            TopLevelItem.SubMenu.ItemSpacing = 5;
            TopLevelItem.SubMenu.OffsetX = -3;
            TopLevelItem.SubMenu.OffsetY = 3;
            TopLevelItem.SubMenu.ShadowDepth = 0;
            TopLevelItem.SubMenu.Style.CssText = "border-right: #e0e0e0 1px solid; padding-right: 3px; border-top: #e0e0e0 1px solid; padding-left: 3px; font-size: 12px; padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #5f7786; padding-top: 3px; border-bottom: #e0e0e0 1px solid; font-family: arial; background-color: #f7f8f9";

            EO.Web.MenuItem Separator = new EO.Web.MenuItem();
            Separator.IsSeparator = true;
            Separator.ItemID = "_Separator";
            Separator.NormalStyle.CssText = "width: 1px; height: 1px; background-color:#e0e0e0;";

            EO.Web.MenuItem Default = new EO.Web.MenuItem();
            Default.HoverStyle.CssText = "color:#F7B00A;padding-left:5px;padding-right:5px;";
            Default.ItemID = "_Default";
            Default.NormalStyle.CssText = "padding-left:5px;padding-right:5px;";
            Default.SubMenu.ItemSpacing = 5;
            Default.SubMenu.OffsetX = 3;
            Default.SubMenu.OffsetY = -4;
            Default.SubMenu.ShadowDepth = 0;
            Default.SubMenu.Style.CssText = "border-right: #e0e0e0 1px solid; padding-right: 3px; border-top: #e0e0e0 1px solid; padding-left: 3px; font-size: 12px; padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #5f7786; padding-top: 3px; border-bottom: #e0e0e0 1px solid; font-family: arial; background-color: #f7f8f9";

            // ---------------------------------- ADD THE LOOK ITEMS TO THE CONTEXT MENU
            mnu.LookItems.Add(TopLevelItem);
            mnu.LookItems.Add(Separator);
            mnu.LookItems.Add(Default);

            // ---------------------------------- ADD TOP LEVEL ITEMS TO CONTEXT MENU
            mnu.TopGroup.Items.Add(mAdd);
            mnu.TopGroup.Items.Add(mEdit);
            mnu.TopGroup.Items.Add(mDelete);
            
            // ---------------------------------- ADD SUB-ITEMS TO CONTEXT MENU
            mnu.TopGroup.Items[0].SubMenu.Items.Add(mAddSub);
            mnu.TopGroup.Items[1].SubMenu.Items.Add(mEditSub);
            mnu.TopGroup.Items[2].SubMenu.Items.Add(mDeleteSub);

            // ---------------------------------- ADD THE CONTROLS
            this.Controls.Add(incoming);
            this.Controls.Add(itemAdd);
            this.Controls.Add(itemEdit);
            this.Controls.Add(itemDelete);
            this.Controls.Add(mnu);
        }

        protected override void RenderContents(HtmlTextWriter output)
        {
            // ---------------------------------- RENDER BASIC CONTROL (TEXT BOX)
            incoming.RenderControl(output);
            // ---------------------------------- RENDER CUSTOM ITEMS
            itemAdd.RenderControl(output);
            itemEdit.RenderControl(output);
            itemDelete.RenderControl(output);
            // ---------------------------------- RENDER CONTEXT MENU
            mnu.RenderControl(output);
        }
    }
}


Please let me know why this is happening, if it is a bug, what can be done...

Thank you!
Allen
Budz
Posted: Friday, April 18, 2008 9:01:30 AM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
Another thing (if it helps at all)...

I noticed in the HTML that is output the difference seen below.

This is the working control with no custom items:

Code: HTML/ASPX
<!-- Begin EO.Web ContextMenu ctl00.  -->

<script type="text/javascript">
//<![CDATA[
var _eo_debug=true;
var _eo_aspnet11=0;

//]]>
</script><div style="position:absolute; top:-1000px;"><input type="hidden" name="eo_version" value="4.0.23.2" /></div>
<div id="EOTestControl1_ctl00" style="display:none;position:absolute;width:300px;">
</div>
<script type="text/javascript">
//<![CDATA[
window._eo_initobj_EOTestControl1_ctl00=function(){var list="i|u|pop|ei|nv|m".split("|");for(var i=0; iscript>

<!-- End EO.Web ContextMenu ctl00.  -->


...and this is the Non-working version of the control (the one With custom items):

Code: HTML/ASPX
<script type="text/javascript">
//<![CDATA[
var _eo_debug=true;
var _eo_aspnet11=0;

//]]>
</script><div style="position:absolute; top:-1000px;"><input type="hidden" name="eo_version" value="4.0.23.2" /></div>
<div style="display:none"></div>
<!-- Begin EO.Web ContextMenu ctl00.  -->
<div id="EOTestControl2_1_ctl00" style="display:none;position:absolute;width:300px;">
</div>
<script type="text/javascript">
//<![CDATA[
window._eo_initobj_EOTestControl2_1_ctl00=function(){var list="i|u|pop|ei|nv|m".split("|");for(var i=0; iscript>

<!-- End EO.Web ContextMenu ctl00.  -->


You'll notice some of the javascript (as you talked about in an earlier post) is not included in the EO.Web ContextMenu section. I'm not sure what creates this piece of HTML, but this is the one thing I've noticed that has been consistently different between the 'working' and 'non-working' versions.

Hope this helps!
Allen
eo_support
Posted: Friday, April 18, 2008 9:39:13 AM
Rank: Administration
Groups: Administration

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

Thanks for the additional information. Just wanted to let you know that we are working on it and will get back to you as soon as we find anything.

Thanks
Budz
Posted: Friday, April 18, 2008 10:59:04 AM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
By the way, (I think I alluded to this in my first post, but to reiterate) the control I'm creating is to be compiled to a dll and added to the toolbox -- this is Not an ascx file.

Thank you,
Allen
eo_support
Posted: Friday, April 18, 2008 11:06:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,093
Budz wrote:
By the way, (I think I alluded to this in my first post, but to reiterate) the control I'm creating is to be compiled to a dll and added to the toolbox -- this is Not an ascx file.

Thank you,
Allen


Yes. We understand that.
eo_support
Posted: Friday, April 18, 2008 3:26:02 PM
Rank: Administration
Groups: Administration

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

Try to change:

Code: C#
// ---------------------------------- RENDER BASIC CONTROL (TEXT BOX)
incoming.RenderControl(output);
// ---------------------------------- RENDER CUSTOM ITEMS
itemAdd.RenderControl(output);
itemEdit.RenderControl(output);
itemDelete.RenderControl(output);
// ---------------------------------- RENDER CONTEXT MENU
mnu.RenderControl(output);


To:


Code: C#
// ---------------------------------- RENDER BASIC CONTROL (TEXT BOX)
incoming.RenderControl(output);
// ---------------------------------- RENDER CONTEXT MENU
mnu.RenderControl(output);
// ---------------------------------- RENDER CUSTOM ITEMS
itemAdd.RenderControl(output);
itemEdit.RenderControl(output);
itemDelete.RenderControl(output);


Note the order in which they are rendered ---- if the CustomItems are rendered before the menu, you will get the error. The error won't occur if they are rendered after the menu.

This obviously is a bug so we will see if we can fix it. In the mean time change the rendering order should be able to get rid of the problem. Sorry about the issue!

Thanks
Budz
Posted: Monday, April 21, 2008 7:18:37 AM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
Thank you for your help...

I did try the change you suggested in your last post. It worked! Until I tried putting it into use in a master page scenario.

On a regular, stand-alone page, the control now works as expected.

With a master page, I've tried putting the control:

by itself on the master page,
by itself on the slave page,
after a callback panel on the master page,
after a callback panel on the slave page, as well as
putting a callback panel on the master page (above the content placeholder) and the control on the slave page.

In all cases, I get no context menu upon right-clicking (and of course, by extension, no custom items).

Thank you for your continued attention to this matter. I understand that you are working to fix this bug... hopefully this helps to narrow it down.

if you have another quick work around it would be appreciated!

Thanks,
Allen
eo_support
Posted: Monday, April 21, 2008 8:32:36 AM
Rank: Administration
Groups: Administration

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

Try to change

mnu.ContextControlID = this.ID

To:

mnu.ContextControlID = this.ClientID

ContextControlID takes client ID, so that you can specify not only an ID of a server control, but also an ID of any DHTML element.

We've sent you a private message with a new build that should work regardless the sequence that the controls are rendered. You can try that one out if you are interested.

Thanks
Budz
Posted: Monday, April 21, 2008 12:23:09 PM
Rank: Member
Groups: Member

Joined: 4/17/2008
Posts: 11
Changing

mnu.ContextControlID = this.ID;

to

mnu.ContextControlID = this.ClientID;

seems to have worked! I am going to do some more testing on this, but at this ppint the control seems to be working.

I have not been able to access the build, but hopefully I don't need it now.

Thank you for all your help on this. I will say that I am impressed with the quick response time with all the posts. Keep up the good work!

Thanks again,
Allen
eo_support
Posted: Monday, April 21, 2008 12:39:11 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,093
Excellent. Thanks for the update!


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.