Datefield selection into a string for use in a SQL procedure

  1. #1

    Datefield selection into a string for use in a SQL procedure

    Hi I am new to EXT.net and am trying to use the datefield.

    I have it showing using this ->
    <ext:Window ID="dateWindow"
                runat="server"
                Width="350"
                Title="DateRange"
                Icon="Date"
                Closable="false"
                BodyPadding="2"
                Layout="Anchor"
                DefaultAnchor="100%"
                X="0"
                Y="0" >
                <Items>
                    <ext:DateField 
                        ID="DateField1"
                        runat="server"
                        Vtype="daterange"
                        FieldLabel="From"
                        >
                        <CustomConfig>
                            <ext:ConfigItem Name="endDateField" Value="DateField2" Mode="Value" />                        
                        </CustomConfig>
                    </ext:DateField>       
                    <ext:DateField
                        ID="DateField2"
                        runat="server"
                        Vtype="daterange"
                        FieldLabel="To" >
                        <CustomConfig>
                            <ext:ConfigItem Name="startDateField" Value="DateField1" Mode="Value" />
                        </CustomConfig>
                    </ext:DateField>
                    <ext:Button ID="getReportBtn" runat="server" OnClick="getReportBtn_Click" Text="GO"></ext:Button>                 
     </Items>
                </ext:Window>
    Which works fine but I need to use the dates in a stored SQL procedure. So i need to convert the selection into a string.

    I though using this would do it but it doesn't
       string paramEnd_Date = (string)DateField1.ToString("yyyy-MM-dd");
    Any help would be appreciated.

    Mark
  2. #2
    Hi Mark,

    Welcome to the Ext.NET forums!

    Please use a DateField1's SelectedDate property.
    DateField1.SelectedDate.ToString("yyyy-MM-dd")

Similar Threads

  1. Datefield/Timefield string values
    By bacampbe in forum 2.x Help
    Replies: 6
    Last Post: Mar 12, 2014, 1:01 PM
  2. [CLOSED] DateField Detect Calendar selection
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 25, 2013, 11:03 PM
  3. Replies: 1
    Last Post: Jun 29, 2011, 3:00 AM
  4. Allow Post date selection in DateField
    By Rupesh in forum 1.x Help
    Replies: 2
    Last Post: Sep 08, 2010, 10:47 AM
  5. Replies: 2
    Last Post: Oct 13, 2009, 5:35 AM

Tags for this Thread

Posting Permissions