[CLOSED] [1.0] Combo box add event runtime

  1. #1

    [CLOSED] [1.0] Combo box add event runtime

    Hi,

    first of all sorry for this topic title.
    Now i see it's the same of one of my previous topic (solved, thanks!), but now it's a different question...

    i need to add an server event runtime to a combo box.

    I try

    combo.AddEvents("MyEvent()")
    also with

    AddHandler Combo.ItemSelected, AddressOf MyEvent
    where MyEvent is something like this

    Public Sub MyEvent(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim a As Integer = 0
        ...my code here
    End Sub
    please, let me know how add this handler runtime to my combo.

    thanks in advance

  2. #2

    RE: [CLOSED] [1.0] Combo box add event runtime

    Example

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!X.IsAjaxRequest)
        {
            this.ComboBox1.DirectEvents.Select.Event += ComboBox1_Select;
        }
    }
    
    protected void ComboBox1_Select(object sender, DirectEventArgs e)
    {
        // do something
    }
    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] [1.0] Combo box add event runtime

    Hi,
    your example is in C# but
    I use Vb.Net and I cannot find the last "EVENT":




    Combo.DirectEvents.Select.<U>Event</U>

    but only
    Combo.DirectEvents.Select....

    How can I add my handler?

    also AddHandler Combo... doesn't work


    Thanks
  4. #4

    RE: [CLOSED] [1.0] Combo box add event runtime

    Hi,

    Does the following code help you?
    AddHandler Combo.ItemSelected.[Event], AddressOf MyEvent

    Also see
    http://forums.ext.net/showthread.php?postid=11934.aspx
  5. #5

    RE: [CLOSED] [1.0] Combo box add event runtime

    Hi vladimir,
    i'm sorry but your code doesn't work and also the link you provide it's about "AjaxEvent"
    I don't find "AjaxEvent" under combo object.

    Now is it "Direct event" ? (I use 1.0)
    I did a test with "MyCombo.DirectEvents.Change", but i don't know how set the event...
    I canot fire my event on combo change in any way...
    Thanks

  6. #6

    RE: [CLOSED] [1.0] Combo box add event runtime

    Hi,

    Please note that Change event fires when a field looses focus (blur event). If you need immediately reaction then use Select event
  7. #7

    RE: [CLOSED] [1.0] Combo box add event runtime

    Hi,
    I try also with this:

    With Combo.DirectEvents.Select
          .EventMask.ShowMask = True
          .Complete = "CaricaCampiCollegati"
    End With
    without any success...
    But it's right add a direct event in that way?

    With a button click I do:
    Dim BttnClose As New Ext.Net.Button
            BttnClose.Icon = Icon.BulletCross
            BttnClose.ID = "BTTN_CHIUDI_" &amp; Obj.ORMcampo.Campo
         
            BttnClose.DirectEvents.Click.ExtraParams.Add(New Parameter("CAMPO", Obj.ORMcampo.Campo))
            BttnClose.DirectEvents.Click.EventMask.ShowMask = True
            BttnClose.DirectEvents.Click.EventMask.Msg = "Chiusura filtro in corso..."
         
            AddHandler BttnClose.DirectClick, AddressOf BottoneChiudiFiltro
    and it's work!
    Note that i add all my control after a button click, so all combo and button controls don't exist at the 1st page.load event
    but i store all in a list and a re-create every postback
    [like the example you provide: http://forums.ext.net/showthread.php...231-16-1.aspx]

    The button event works, but about the combo event I don't know how i can do...
    Thanks
  8. #8

    RE: [CLOSED] [1.0] Combo box add event runtime

    Hi,

    Does the following example work for you?
    <%@ Page Language="VB" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head id="Head1" runat="server">                  
            <title>
            </title>
            
            <script runat="server">
                Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
                    
                    With Combo1
                        .DirectEvents.Select.EventMask.MinDelay = 1000
                        .DirectEvents.Select.EventMask.ShowMask = True
                        .DirectEvents.Select.EventMask.Msg = "Performing search..."
                        AddHandler .DirectEvents.Select.Event, AddressOf Combo1_Select
                    End With
                End Sub
                
                Protected Sub Combo1_Select(ByVal sender As Object, ByVal e As DirectEventArgs)
                    Ext.Net.X.Js.Alert("Done")
                End Sub
    
            </script>
        </head>
        
        <body>
            <form id="frmTemplate" runat="server">
                <ext:ResourceManager ID="ResourceManager1" runat="server"></ext:ResourceManager>           
                
                
                <ext:ComboBox ID="Combo1" runat="server">
                    <Items>
                        <ext:ListItem Text="1" />
                        <ext:ListItem Text="2" />
                        <ext:ListItem Text="3" />
                    </Items>
                </ext:ComboBox>
            </form>
        </body>
    </html>
  9. #9

    RE: [CLOSED] [1.0] Combo box add event runtime

    Hi Vlasch,
    first of all thanks for your quick reply!

    If I add a combo in markup, as you do, directly in ASPX page, your code works, but if I add my combo runtime, even if I provide to re-create and add handler every postback, the select combo event doesn't work.

    BUT now I found my mistake: i do a "render" of the panel that contain my combo BEFORE attach the event!
    now I do "render" after "AddHandler .DirectEvents.Select.Event, AddressOf Combo1_Select"
    and all work properly!

    Many thanks!



Similar Threads

  1. Replies: 1
    Last Post: May 09, 2012, 7:08 PM
  2. create event for gridpanel at runtime
    By kyawthura.mr in forum 1.x Help
    Replies: 4
    Last Post: Aug 10, 2011, 9:20 AM
  3. [CLOSED] [1.0]Set combo listItem icon at runtime
    By edigital in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 03, 2010, 11:12 AM
  4. Replies: 3
    Last Post: May 11, 2010, 10:36 AM
  5. [CLOSED] [1.0] combo addEvents runtime error - BUG?
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 04, 2010, 10:42 AM

Posting Permissions