[CLOSED] Creating DirectEvent from codebehind

  1. #1

    [CLOSED] Creating DirectEvent from codebehind

    currently I make it this way:

    statusComboBox.DirectEvents.Change.Event += new ComponentDirectEvent.DirectEventHandler(StatusIdFilter_Change_Event;
    I wonder if I could specify it with config inside

    DirectEvents = {
        (....)
    }
    how to do it?
    Last edited by geoffrey.mcgill; Mar 01, 2011 at 3:29 PM. Reason: [CLOSED]
  2. #2
    Hi,

    You could specify DirectEvent properties in the constructor, but I don't know any alternate way of '+=' to attach a handler.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            var b = new Ext.Net.Button()
            {
                Text = "Click me",
                DirectEvents =
                {
                    Click =
                    {
                        Success = "alert('Success');"   
                    }
                }
            };
            b.DirectEvents.Click.Event += TestDirectEventHandler;
            this.Form.Controls.Add(b);
        }
    
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("DirectEvent", "Hello from Server!").Show();
        }
    </script>
    
    <!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 runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Creating Combobox + Store in CodeBehind
    By trezv in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 12, 2015, 1:41 PM
  2. [CLOSED] Creating and Show ext.Window in CodeBehind
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 08, 2012, 3:31 PM
  3. Replies: 6
    Last Post: Apr 07, 2010, 4:18 AM
  4. Creating a Store From CodeBehind
    By ahmetmeral in forum 1.x Help
    Replies: 5
    Last Post: Dec 14, 2008, 5:14 PM
  5. Creating a delux portal from codebehind.
    By prashobkumar in forum 1.x Help
    Replies: 1
    Last Post: Dec 09, 2008, 11:36 AM

Posting Permissions