MenuItem Click event is not working

  1. #1

    MenuItem Click event is not working

    .CS File (Codebehind code)
    -------------------------------------------------------------------------
    private void LoadMenu()
            {
                UserServiceClient UserService = new UserServiceClient();
                try
                {
                    ModuleMaster[] mm;
                    mm = UserService.SelectModuleBasedOnUserName("user");
    
    
                    MenuPanel objMenuPanel = new MenuPanel();
                    objMenuPanel.Title = "Patient";
                    objMenuPanel.IconCls = "mnu-patientScheduling-icon16";
                    objMenuPanel.Collapsed = true;
                    objMenuPanel.AutoScroll = false;
                    objMenuPanel.AutoHeight = true;
                    objMenuPanel.SaveSelection = false;
                    objMenuPanel.ID = "MP_" + "111";
                    for (int i = 0; i < mm.Length; i++)
                    {
                        Ext.Net.MenuItem objMenuItem;
                        if (mm[i].ModuleGroupName == "user")
                        {
                            objMenuItem = new Ext.Net.MenuItem();
                            objMenuItem.ID = "MI_" + mm[i].ModuleID.ToString();
                            //objMenuItem.ClientID = "MI_" + mm[i].ModuleID.ToString();
                            objMenuItem.IconCls = mm[i].MenuIconClass;
                            objMenuItem.Text = mm[i].ModuleName;
                            objMenuItem.DirectEvents.Click.Event += MenuItem_Click;
                            objMenuItem.AutoPostBack = false;
                            objMenuPanel.Menu.Items.Add(objMenuItem);
                        }
                    }
                    if (objMenuPanel.Menu.Items.Count > 0)
                    {
                        Panel2.Items.Add(objMenuPanel);
                        // this.Items.Add(objMenuPanel);
                    }
                }
                catch (Exception ee)
                {
                    WebPageException.HandleException(ee, "DesktopUiError");
                }
              
            }
            protected void MenuItem_Click(object sender, Ext.Net.DirectEventArgs e)
            {
            }
    
    ----------------------------------------------------------------
    .Aspx page
    -------------------------------------------------------------
    <ext:Viewport ID="Viewport1" runat="server" Layout="border">
            <Items>
            
          
                    <ext:Panel ID="Panel2" 
                        runat="server" 
                        Width="350" 
                        Layout="Accordion" 
                        Split="true" 
                        Region="West" 
                        Margins="5 0 5 5" 
                        DefaultBorder="false" CollapseMode="Mini" Collapsible="true">
                        <Items>
                          
                        </Items>
                    </ext:Panel>
                    <ext:Panel 
                        ID="pnlCenter" 
                        runat="server" 
                        Title="Selected Item" 
                        Padding="5" 
                        Region="Center" 
                        Margins="5 5 5 0" 
                        ></ext:Panel>
                        
                        
                </Items>
                </ext:Viewport>
    ------------------------------------------------------------
    In the above provided code, i am creating Dynamically MenuItems it's created. But i am unable to find the MenuItemID on the click of MenuItem.
    It's throughing the error --- The control with ID 'ctl00_ContentPlaceHolder1_MI_48' not found

    How to solve this, Any Ideas Please reply as soon as possible.
    Last edited by Daniil; Mar 22, 2011 at 2:45 PM. Reason: Please use [CODE] tags
  2. #2
    i got it.......

Similar Threads

  1. Replies: 1
    Last Post: May 09, 2012, 7:08 PM
  2. Replies: 3
    Last Post: Mar 23, 2011, 5:32 PM
  3. Replies: 2
    Last Post: Feb 16, 2011, 8:36 AM
  4. How to get parent menuItem when click menuItem?
    By zhangsir199 in forum 1.x Help
    Replies: 2
    Last Post: Jan 21, 2011, 2:58 AM
  5. Replies: 5
    Last Post: Jan 06, 2011, 9:58 PM

Posting Permissions