[CLOSED] Dynamic created MenuItems and directEvents

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Dynamic created MenuItems and directEvents

    Releated to the following topic Disable a MenuItem when button selected I began to add click directevents so that the server could load new data into the grid, but I received the following error:

    The control with ID 'CfdbVer24' not found.
    Below is a seqment of the code:

    ...
     <TopBar>
        <ext:Toolbar runat="server">
          <Items>
              <ext:Button runat="server" Icon="Database" >
                 <Menu>
                    <ext:Menu ID="CfdbOptionsMenu" runat="server">
                   <%-- MenuItems dynamically create in behind code --%>
                 </Menu>
              </ext:Button>
              <ext:Label ID="CfdbVersionTitle" runat="server" />
           </Items>
        </ext:Toolbar>
     </TopBar>
     ...
    protected void Page_Load(object sender, EventArgs e) {
        if (!X.IsAjaxRequest)    {
           CFVDataContext dc = new CFVDataContext;
    
           // Retrieve all available versions that can be selected.
           var q = from c in dc.CfdbVersions
                      where c.IsActive == true
                      orderby c.Order descending
                      select c;
           // Create the menu items
           foreach (var c in q)
              {
              Ext.Net.MenuItems item = new Ext.Net.MenuItems() {
                 ID = "CfdbVer" + c.CfdbVer.ToString(),
                 Text = c.Description,
                 Icon = Icon.Database
              };
    
              item.DirectEvents.Click.Event += SelectCfdbVersion;
    
              Ext.Net.Parameter prmVer = new Ext.Net.Parameter() {
                 Name = "Version",
                 Value = c.CfdbVer.ToString(),
                 Mode = Parameter.Value
              }
             item.DirectEvents.Click.ExtraParams.Add(prmVer);
    
               Ext.Net.Parameter prmDesc = new Ext.Net.Parameter() {
                 Name = "Description",
                 Value = c.Description,
                 Mode = Parameter.Value
              }
             item.DirectEvents.Click.ExtraParams.Add(prmDesc);
    
             item.addTo(CfdbOptionsMenu);
           }
        }
     }
    protected void SelectCfdbVersion (object sender, DirectEventArgs e)
    {
       string Description = e.ExtraParams["Description"];
       string version = e.ExtraParams["Version"];
    }
    I found the following thread Gridpanel Directevent in code behind and removed the test of "if (!X.IsAjaxRequest) { }" from the Page_Load method and I am still having an issue.

    Do you have any additional suggestions or examples.
    Last edited by Daniil; Jun 14, 2012 at 5:25 PM. Reason: [CLOSED]

Similar Threads

  1. Replies: 0
    Last Post: Feb 06, 2012, 1:59 PM
  2. [CLOSED] Dynamic DirectEvents
    By albayrak in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 10, 2011, 9:12 AM
  3. [CLOSED] Dynamcally created Combox and its Dynamic Store
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 21, 2011, 4:10 PM
  4. Dynamic Menu with DirectEvents
    By Ganesh3.shirsath in forum 1.x Help
    Replies: 4
    Last Post: Oct 16, 2010, 6:01 PM
  5. Dynamic DirectEvents
    By Dominik in forum 1.x Help
    Replies: 3
    Last Post: Jul 30, 2010, 12:58 PM

Posting Permissions