[CLOSED] DateTime parameter on DirectEvent

  1. #1

    [CLOSED] DateTime parameter on DirectEvent

    Hi,

    In an MVC application I'm using code similar to the following:

    <%@ Page Language="C#" %>  
    <%@ 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>Ext.NET</title> 
            <script type="text/javascript">
                var getTheDate = function () {
                    var d = new Date(2010, 09, 10);
                    return d;
                };
                var getTheInt = function () {
                    var i = parseInt(123);
                    return i;
                };
            </script>
        </head>
        <body>     
            <form id="Form1" runat="server">         
                <ext:ResourceManager ID="ResourceManager1" runat="server" />           
                <ext:Button ID="ButtonInt" runat="server" Text="Test Int" Icon="Accept">
                    <DirectEvents>
                        <Click
                            Url="/Test/TestInt/"  
                            CleanRequest="true" 
                            Method="POST"
                            Success="Ext.Msg.show({
                                title:   'Test OK',
                                msg:     'OK.',
                                buttons: Ext.Msg.OK,
                                icon:    Ext.MessageBox.INFO
                            });"
                            Failure="Ext.Msg.show({
                                title:   'Test KO',
                                msg:     result.errorMessage,
                                buttons: Ext.Msg.OK,
                                icon:    Ext.MessageBox.ERROR
                            });">
                            <ExtraParams>
                                <ext:Parameter Name="theInt" Value="getTheInt()" Mode="Raw" />
                            </ExtraParams>
                        </Click>
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="ButtonDateTime" runat="server" Text="Test Date" Icon="DateGo">
                    <DirectEvents>
                        <Click
                            Url="/Test/TestDateTime/"  
                            CleanRequest="true" 
                            Method="POST"
                            Success="Ext.Msg.show({
                                title:   'Test OK',
                                msg:     'OK.',
                                buttons: Ext.Msg.OK,
                                icon:    Ext.MessageBox.INFO
                            });"
                            Failure="Ext.Msg.show({
                                title:   'Test KO',
                                msg:     result.errorMessage,
                                buttons: Ext.Msg.OK,
                                icon:    Ext.MessageBox.ERROR
                            });">
                            <ExtraParams>
                                <ext:Parameter Name="theDate" Value="getTheDate()" Mode="Raw" />
                            </ExtraParams>
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </form>
        </body>
    </html>
    these are the controller actions:

            public ActionResult TestDateTime(DateTime theDate)
            {
                return new AjaxResult();
            }
            public ActionResult TestInt(int theInt)
            {
                return new AjaxResult();
            }
    If you click the ButtonInt button, it's all OK.

    If you click theButtonDateTime button, you get the attached error.

    Bye,
    Stefano
    Last edited by Daniil; Sep 20, 2010 at 4:24 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Thank you for the clear example.
    We are investigating this issue.
  3. #3
    Hi,

    Use the following getTheDate method
    var getTheDate = function () {
                    var d = new Date(2010, 09, 10);
                    return d.format("Y-m-d\\TH:i:s"); 
                };

Similar Threads

  1. [CLOSED] Set initial value in DateTime combobox
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 02, 2012, 9:23 AM
  2. Replies: 1
    Last Post: Jun 09, 2011, 7:04 PM
  3. [CLOSED] DateTime Column Formatting
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 29, 2010, 4:55 PM
  4. Datetime
    By Wtower in forum 1.x Help
    Replies: 1
    Last Post: Sep 05, 2009, 9:53 AM
  5. [CLOSED] datetime field
    By Satyanarayana murthy in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 11, 2009, 1:59 PM

Posting Permissions