[CLOSED] Gridpanel Directevent in code behind

  1. #1

    [CLOSED] Gridpanel Directevent in code behind

    Hello,

    How can I do this:

    <DirectEvents>
             <Command OnEvent="DoCommand" >
              <ExtraParams>
                     <ext:Parameter Name="Command" Value="command" Mode="Raw" ></ext:Parameter>
                      <ext:Parameter Name="ItemId" Value="record.data.ComplianceItemId" Mode="Raw"></ext:Parameter>
               </ExtraParams>
              </Command>        
    </DirectEvents>
    in code behind?

     Dim de As New DirectEvent()
            Dim par1 As New Parameter With {.Name = "Command", .Value = "command", .Mode = "Raw"}
            Dim par2 As New Parameter With {.Name = "ItemId", .Value = "record.data.ComplianceItemId", .Mode = "Raw"}
            grid.DirectEvents.Add(de) '????
    Thanks.
    Last edited by Daniil; Nov 15, 2010 at 2:16 PM. Reason: [CLOSED]
  2. #2
    <DirectEvents>
    <Command OnEvent="DoCommand" >
    <ExtraParams>
    <ext:Parameter Name="Command" Value="command" Mode="Raw" ></ext:Parameter>
    <ext:Parameter Name="ItemId" Value="record.data.ComplianceItemId" Mode="Raw"></ext:Parameter>
    </ExtraParams>
    </Command> 
    </DirectEvents
    in code behind?

    Dim de As New DirectEvent()
    Dim par1 As New Parameter With {.Name = "Command", .Value = "command", .Mode = "Raw"}
    Dim par2 As New Parameter With {.Name = "ItemId", .Value = "record.data.ComplianceItemId", .Mode = "Raw"}
    grid.DirectEvents.Add(de) '????
    Thanks.
  3. #3
    Hi,

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Ext.Net.Button button = new Ext.Net.Button() { Text = "Click me" };
            button.DirectEvents.Click.Event += Button_Click;
            Ext.Net.Parameter testParam = new Ext.Net.Parameter()
            {
                Name = "test",
                Value = "Hello World",
                Mode = ParameterMode.Value
            };
            button.DirectEvents.Click.ExtraParams.Add(testParam);
    
            this.Form.Controls.Add(button);
        }
    
        protected void Button_Click(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Button_Click", e.ExtraParams["test"]).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>
  4. #4
    Quote Originally Posted by Daniil View Post
    Hi,

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Ext.Net.Button button = new Ext.Net.Button() { Text = "Click me" };
            button.DirectEvents.Click.Event += Button_Click;
            Ext.Net.Parameter testParam = new Ext.Net.Parameter()
            {
                Name = "test",
                Value = "Hello World",
                Mode = ParameterMode.Value
            };
            button.DirectEvents.Click.ExtraParams.Add(testParam);
    
            this.Form.Controls.Add(button);
        }
    
        protected void Button_Click(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Button_Click", e.ExtraParams["test"]).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>
    This piece of code does not work.
  5. #5
    Quote Originally Posted by mdarco View Post
    This piece of code does not work.
    Hi,

    Well, I tested it before posting and tested it again, works fine.

    Generally speaking, your information is not too helpful.

    What exactly does not it work? Errors, exception? Which browsers do you use to test under? Which OS?

Similar Threads

  1. Replies: 2
    Last Post: Dec 19, 2014, 12:29 AM
  2. [CLOSED] Update the DirectEvent Click URL from code behind
    By speedstepmem3 in forum 1.x Premium Help
    Replies: 2
    Last Post: Jun 15, 2011, 11:08 AM
  3. Replies: 1
    Last Post: Jun 09, 2011, 8:04 PM
  4. Replies: 6
    Last Post: Jun 18, 2010, 5:23 PM
  5. [CLOSED] [1.0] GridPanel DirectEvent ExtraParams
    By jhouser in forum 1.x Premium Help
    Replies: 2
    Last Post: Jan 07, 2010, 11:12 AM

Tags for this Thread

Posting Permissions