help for a beginner! as a procedure call ?

  1. #1

    [CLOSED] help for a beginner! as a procedure call ?

    Hi, I have this code I got from the demos Ext.Net, I'd like to know is how instead of calling a
    Ext.Msg.alert('Submit', 'Saved!'); can call a public void .... To run a code that I have.

                <Buttons>
                    
    <ext:Button runat="server" Text="Save">
                        <Listeners>
                            <Click Handler="if (#{FormPanel1}.getForm().isValid()) {Ext.Msg.alert('Submit', 'Saved!');}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: 'FormPanel is incorrect', buttons:Ext.Msg.OK});}" />
                        </Listeners>
                    </ext:Button>
                    
                </Buttons>
    I await your response, Gracias.
    Last edited by julioc_m18; Feb 10, 2011 at 2:10 PM.
  2. #2
    Hi,

    Here's a sample which demonstrates two options (DirectEvent vs Listener) for handling the Button click event.

    The <Click> DirectEvent will call a server-side Event handler. The <Click> Listener will call a [DirectMethod].

    Both do essentially the same thing by calling a server-side Method from the client-side.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            X.Msg.Notify("Server Time (DirectEvent)", DateTime.Now.ToLongTimeString()).Show();
        }
        
        [DirectMethod(Namespace = "CompanyX")]
        public void DoSomething()
        {
            X.Msg.Notify("Server Time (Listener)", DateTime.Now.ToLongTimeString()).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 id="Head1" runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Button runat="server" Text="DirectEvent">
                <DirectEvents>
                    <Click OnEvent="Button1_Click" />
                </DirectEvents>
            </ext:Button>
            
            <ext:Button runat="server" Text="Listener">
                <Listeners>
                    <Click Handler="CompanyX.DoSomething();" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3

    Thank's! but another question.

    I wonder if it can be placed inside the IF
    If the Form is validated to run the protected void, otherwise to show me the validation error message.

    <Listeners>
                            <Click Handler="if (#{FormPanel1}.getForm().isValid()) {Ext.Msg.alert('Submit', 'Saved!');}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: 'FormPanel is incorrect', buttons:Ext.Msg.OK});}" />
                        </Listeners>
    I would change is:

    Ext.Msg.alert('Submit', 'Saved!');
    Last edited by geoffrey.mcgill; Feb 09, 2011 at 10:48 PM. Reason: please use [CODE] tags
  4. #4
    Yes, you code looks correct.

    With future posts, please ensure you wrap your code samples in [CODE] tags. thx.

    http://forums.ext.net/showthread.php...ing-New-Topics
    Last edited by geoffrey.mcgill; Feb 09, 2011 at 11:06 PM.
    Geoffrey McGill
    Founder
  5. #5
    I'm Sorry.... Let me not seem to understand
    I do not want to show the message "saved", instead want to run a public void.

    <Click Handler="if (#{FormPanel1}.getForm().isValid()) {CALL THE VOID CALL THE VOID }else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: 'FormPanel is incorrect', buttons:Ext.Msg.OK});}" />
    Sorry and Thanks.

    do not speak English Do use googleTraductor.
  6. #6
    The following should work.

    Example

    <Click Handler="if (#{FormPanel1}.getForm().isValid()) { CompanyX.DoSomething(); }else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: 'FormPanel is incorrect', buttons:Ext.Msg.OK});}" />
    Geoffrey McGill
    Founder
  7. #7

    [CLOSED] help for a beginner! as a procedure call ?

    Thank you very much geoffrey.mcgill.
    I served.

      [DirectMethod(Namespace = "CompanyX")]
        public void DoSomething()
        {
            X.Msg.Notify("Server Time (Listener)", DateTime.Now.ToLongTimeString()).Show();
        }

    By chance you'll know this code in. VB.
    code converters I tried but I was.

    Reitero mi agradecimiento.

Similar Threads

  1. [CLOSED] Invalid procedure call or argument
    By wisdomchuck in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 06, 2012, 6:13 PM
  2. Replies: 1
    Last Post: Aug 21, 2010, 9:49 AM
  3. Replies: 0
    Last Post: Aug 05, 2010, 6:08 AM
  4. Replies: 11
    Last Post: Feb 06, 2009, 7:45 AM
  5. Sqldatasource - Update With Stored Procedure
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Jan 20, 2009, 8:51 PM

Tags for this Thread

Posting Permissions