Dynamic Menu Server Side events

  1. #1

    Dynamic Menu Server Side events

    Hi ,


    I creating dynamic menu menu using Ext.Net. I need to fire an server side event when i click on menu item.

    please give any example for server side menu item events. I have searched the forum but i got the coolite example. So i need a small example with ext.net. Please Help me.


    thanks
    Seshu
  2. #2
    hi..

    i'm having the same problem also

    I always get error saying the component are not found.

    please help
  3. #3
    Any dynamic control must be recreated to handle server side events
    Vladimir Shcheglov
    Sr. Developer
  4. #4
    thanks for the fast reply.

    care to give example?

    since if debug the code...its executing the portion to creating the menu again.

    *still preparing sample code
  5. #5
                            <ext:Panel ID="SingleResultGroupHeader" runat="server" Layout="ColumnLayout">
                                <TopBar>
                                    <ext:Toolbar ID="Toolbar_SingleResultGroupHeader" runat="server">
                                        <Items>
                                            <ext:Button ID="btnCategoryMenu" runat="server" Text="REPORT ALL">
                                                <Menu>
                                                    <ext:Menu ID="CategoryMenu" runat="server" ShowSeparator="false">
                                                        <Items>
                                                            <ext:ComponentMenuItem ID="ComponentMenuItem_CategoryMenu" runat="server" Shift="false">
                                                                <Component>
                                                                    <ext:Container ID="Container_CategoryMenu" runat="server" Width="600" Height="200" Layout="HBox">
                                                                    </ext:Container>
                                                                </Component>
                                                            </ext:ComponentMenuItem>
                                                        </Items>
                                                    </ext:Menu>
                                                </Menu>
                                            </ext:Button>
                                    </ext:Toolbar>                                                        
                                </TopBar>
                            </ext:Panel>
            private void PrepareMenu(Ext.Net.Container ContainerName,  DataTable dt)
            {
                StringCollection groupes = GetGroupCollections(dt);
    
                foreach (string group in groupes)
                {
                    Ext.Net.MenuPanel grouppanel = new Ext.Net.MenuPanel();
                    grouppanel.MinHeight = Unit.Pixel(200);
    
                    DataView view = new DataView(dt);
                    view.RowFilter = string.Format("[Group] = '{0}'", group);
    
                    CreateRoot(grouppanel, group, dt);
    
                    ContainerName.Items.Add(grouppanel);
                }
            }
    
            private void CreateRoot(Ext.Net.MenuPanel grouppanel, string group, DataTable dt)
            {
                DataView rootview = new DataView(dt);
                rootview.RowFilter = string.Format("[Group] = '{0}' AND [IsRoot] = true", group);
    
                foreach (DataRowView vrow in rootview)
                {
                    Ext.Net.MenuItem item = new Ext.Net.MenuItem();
                    item.Text = string.Concat(vrow["Item"].ToString(), "&nbsp;", "(", vrow["Count"].ToString(), ")");
                    item.DirectEvents.Click.Event += new Ext.Net.ComponentDirectEvent.DirectEventHandler(Click_Event);
    
                    grouppanel.Menu.Items.Add(item);
    
                    CreateChilds(grouppanel, group, vrow["Item"].ToString(), dt, 1);
                }
            }
    
            private void CreateChilds(Ext.Net.MenuPanel grouppanel, string groupview, string parent, DataTable Tree, int level)
            {
                DataView childview = new DataView(Tree);
                childview.RowFilter = string.Format("[Group] = '{0}' AND [IsRoot] = false AND [ParentItem] = '{1}'", groupview, parent);
    
                foreach (DataRowView vrow in childview)
                {
                    Ext.Net.MenuItem item = new Ext.Net.MenuItem();
                    item.Text = string.Concat(DeepSpace(level), vrow["Item"].ToString(), "&nbsp;", "(", vrow["Count"].ToString(), ")");
    
                    grouppanel.Menu.Items.Add(item);
                }
            }
    
            void Click_Event(object sender, Ext.Net.DirectEventArgs e)
            {
                //fail on click
                Ext.Net.X.Msg.Alert("asdf", " aaaa").Show();
            }
    do u need the page_load method also?
    Last edited by GitzJoey; Sep 12, 2011 at 2:04 PM.
  6. #6
    Please see the following post demonstrates dynamic controls recreation
    http://forums.ext.net/showthread.php...ll=1#post41727
    Vladimir Shcheglov
    Sr. Developer
  7. #7
    Quote Originally Posted by Vladimir View Post
    Please see the following post demonstrates dynamic controls recreation
    http://forums.ext.net/showthread.php...ll=1#post41727
    in my case, do i need to put .render() ?

    i'm sorry but i think i've done everything in your sample (re-initialize, re-register event, re-add to the container control, and render)
  8. #8

    Thanks Vladimir

    Quote Originally Posted by Vladimir View Post
    Any dynamic control must be recreated to handle server side events
    The Issue has been resolved.
    Now i am able to fire the Direct events from a dynamically created menu item.
  9. #9

    Need More Info

    Please post your code for reference as I have the same issue

Similar Threads

  1. Replies: 6
    Last Post: May 19, 2011, 10:36 AM
  2. [CLOSED] NumberField set client Events server side
    By majestic in forum 1.x Premium Help
    Replies: 1
    Last Post: Dec 05, 2010, 11:03 AM
  3. Replies: 4
    Last Post: Mar 19, 2010, 12:35 PM
  4. How to fire server side event for menu item.
    By Satyanarayana murthy in forum 1.x Help
    Replies: 5
    Last Post: Dec 03, 2009, 11:55 AM
  5. [CLOSED] Calling server side meathod on keyboard events
    By Etisbew in forum 1.x Premium Help
    Replies: 6
    Last Post: Jun 23, 2009, 5:23 AM

Posting Permissions