[CLOSED] Split Button Menu add Item dynamicaly

  1. #1

    [CLOSED] Split Button Menu add Item dynamicaly

    Hi all

    I need to add Split Button Menu Items dynamically.

    I try to add Items to this Split Button :

                          <ext:SplitButton runat="server" ID="DocumentSplitButton" Icon="PageMagnify">
                            <Menu>
                              <ext:Menu runat="server">
    
                              </ext:Menu>
                            </Menu>
                          </ext:SplitButton>
    Here's my Code :

        DocumentSplitButton.Menu(0).Items.Clear()
    
        Dim docs = ServiceClient.GetDocumentsById(id)
        For Each doc As Document In docs
          DocumentSplitButton.Menu(0).Items.Add(New MenuItem() With {.Text = doc.DisplayName}) 
        Next
    The Items seems to be existent during debug but they aren't rendered ?!
    To I miss an update call ?

    Kind Regards
    Peter
    Last edited by Daniil; Jul 22, 2015 at 3:01 PM. Reason: [CLOSED]
  2. #2
    OK, in the meanwhile adding a Menu Item works ! But I face now a new Problem :-/
    While clicking on the Menu Item this Error occures :

    The control with ID 'DocumentPreviewItem_2d579e80-a01c-45cc-9dc2-63d1de7cbde0' not found



    My Code looks like that

        DocumentSplitButton.Menu(0).RemoveAll()
    
        Dim mi As MenuItem
    
        For Each doc As Document In ServiceClient.GetDocumentsById(Guid.Parse(id))
    
          mi = New MenuItem() With {.Text = doc.DisplayName, .Icon = Ext.Net.Icon.PageWhiteAcrobat, .ID = String.Format("DocumentPreviewItem_{0}", doc.Id.ToString)}
    
          AddHandler mi.DirectEvents.Click.Event, AddressOf ShowPreViewWindow
          mi.DirectEvents.Click.ExtraParams.Add((New Ext.Net.Parameter() With {.Value = doc.Id.ToString, .Name = "id", .Mode = ParameterMode.Value}))
    
          mi.AddTo(DocumentSplitButton.Menu(0))
    
          Form.Controls.Add(mi)
        Next
    Any Help is welcome :-)
  3. #3
    Hi Peter,

    I think you are facing the same problem that has been discussed in these threads (and many others).
    http://forums.ext.net/showthread.php...l=1#post105183
    http://forums.ext.net/showthread.php...ll=1#post60155

    You create a dynamic control and attach a DirectEvent to that control, but don't recreate the control when the DirectEvent fires. But DirectEvent requires a control instance on server. You can recreate the dynamic control or use DirectMethods instead.
  4. #4
    Hi Daniil

    the Listener works perfect, thanks for the help !

    Peter

Similar Threads

  1. How to disable button menu item in cshtml
    By simonespagna in forum 2.x Help
    Replies: 2
    Last Post: Jan 05, 2015, 2:04 PM
  2. [CLOSED] Split Button
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 28, 2014, 6:24 PM
  3. Replies: 2
    Last Post: Apr 02, 2012, 7:48 AM
  4. [CLOSED] Split Button behaviour
    By JonG in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 17, 2010, 8:49 AM
  5. Replies: 1
    Last Post: Jan 20, 2010, 6:08 AM

Posting Permissions