DateField in Menu not setting date in Code behind - possible bug?

  1. #1

    DateField in Menu not setting date in Code behind - possible bug?

    Hi,

    I have a datefield within a component menu on a toolbar within a gridpanel, when I attempt to read the datefield.text value or selected date value, after having picked a date, in code behind I get empty text, and not the date.

    I am not sure if I am doing something wrong or this is a bug? In other areas of the application I can read the selected date from the text value.

    Below is a simplified section of code that illustrates the problem I am experiencing, when I inspect the value of txtstartdate.text in the code behind it returns empty string, or if I assign the text a value in the the datefield it returns this value, but not the newly selected date.

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="sandpit.aspx.vb" Inherits="Project_Gems.sandpit" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     <% @ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
      
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
    
          <ext:ResourceManager ID="ResourceManager1" runat="server" />    
    <ext:Store id="stoProjectMilestones" runat="server" GroupField="Tollgate_ID_Description" >
     
     
        <Reader>
            <ext:JsonReader >
                <Fields>
                    <ext:RecordField name="Tollgate_ID_Description" Type="string">         </ext:RecordField>
                    <ext:RecordField name="Tollgate_ID"             Type="int">         </ext:RecordField>
                    <ext:RecordField name="Tollgate_Task_ID"        Type="Int">         </ext:RecordField>
                    <ext:RecordField name="Tollgate_Task_Sequence"  Type="Float">         </ext:RecordField>
                    <ext:RecordField name="Tollgate"                Type="String" >     </ext:RecordField>
                    <ext:RecordField name="Tollgate_Task_Name"      Type="String" >     </ext:RecordField>
                    <ext:RecordField name="Documentation_Attached"  Type="String" >     </ext:RecordField>
                    <ext:RecordField name="Percent_Complete"        Type="Float"  >     </ext:RecordField>
                    <ext:RecordField name="Tollgate_Status_ID"      Type="Int">         </ext:RecordField>
                    <ext:RecordField name="Tollgate_Status"         Type="String">      </ext:RecordField>
                    <ext:RecordField name="Tollgate_Owner_ID"       Type="Int">         </ext:RecordField>
                    <ext:RecordField name="Tollgate_Owner"          Type="String">      </ext:RecordField>
                    <ext:RecordField name="Proposed_Start_Date"     Type="Date" >        </ext:RecordField>
                    <ext:RecordField name="Target_Completion_Date"  Type="Date" >        </ext:RecordField>
                    <ext:RecordField name="Actual_Start_Date"       Type="Date" >        </ext:RecordField>
                    <ext:RecordField name="Actual_Completion_date"  Type="Date" >        </ext:RecordField>
                    <ext:RecordField name="Duration_Days"           Type="Int">         </ext:RecordField>
                    <ext:RecordField name="Actual_duration"         Type="Int">        </ext:RecordField>
                    <ext:RecordField name="TollGateDays"            Type="Int">        </ext:RecordField>
                    <ext:RecordField name="Comments"                Type="String">      </ext:RecordField>
    
                
                </Fields>
            
            </ext:JsonReader>
            
        </Reader>
         
     </ext:Store>
           <ext:GridPanel runat="server"
                    id="grdMilestones"
                    StripeRows ="true"
                    Trackmouseover="true"
                    frame="false"
                    Width="1200"
                    Height="550"           
                    AutoDataBind ="true"
                    Border="true"
                    ShowMask="true" 
                    StoreID ="stoProjectMilestones"
                    ClicksToEdit="50"
                   
                    >
          <TopBar >
            <ext:Toolbar id="tbarProjectMilestones" runat="server" >
                <Items>
                    <ext:Button runat="server" ID="cmdCreateMilestones" Text="Create Project Milestones" Icon="TableAdd" >
                        <Menu>
                            <ext:Menu ID="Menu1" runat="server"  >
                                <items>
                                  
                                   <ext:ComponentMenuItem  runat="server" ID="cmilabel">
                                        <Component>
                                            <ext:Label Text="Enter Start Date:" ID="lblStartDate" runat="server"></ext:Label>
                                        </Component> 
                                    </ext:ComponentMenuItem> 
    
                                   <ext:ComponentMenuItem  runat="server" ID="cmiDate">
                                         <Component>
                                             
                                             <ext:DateField runat="server" Width="200" id="txtStartDate" />
                                                
                                        </Component>
                                    </ext:ComponentMenuItem>
    
                                   <ext:MenuItem runat="server" id="cmdOkCreate" Icon ="Add" Text="Ok" Height="40">
                                            
                                                <DirectEvents >
                                                    <Click OnEvent ="MnuOkClicked"></Click>
                                                    
                                                </DirectEvents>
                                            
                                    </ext:MenuItem> 
                                    <ext:MenuItem runat="server" id="cmdCancel" Icon ="Cancel" Text="Cancel" Height="40">
                                            
                                                
                                            
                                    </ext:MenuItem> 
                                    
                                    <ext:MenuSeparator runat="server" ID="mnuSep1"></ext:MenuSeparator>
                                </items>
    
                            </ext:Menu>
                        </Menu>
                    </ext:Button>
                    <ext:ToolbarSeparator runat="server" ID="tbmnuMilestones"></ext:ToolbarSeparator>
                    <ext:Button ID="cmdEdit" runat="server" Icon="BookEdit" Text="edit" ToolTip ="Edit Existing Milestone">
                        <DirectEvents>
                            
                        </DirectEvents>
                    </ext:Button>
                </Items>
            
            
            </ext:Toolbar>
        
        </TopBar>
    </ext:GridPanel>
    
        </form>
    </body>
    </html>
    Code Behind:
    Public Class sandpit
        Inherits System.Web.UI.Page
    
     Public Sub MnuOkClicked()
            If txtStartDate.Text = "01/01/0001" Or txtStartDate.Text = "" Then
    
                cmdCreateMilestones.ShowMenu()
                txtStartDate.ShowIndicator()
                lblStartDate.StyleSpec = "color:red;"
                Exit Sub
            End If
    
            lblStartDate.StyleSpec = "color:black;"
    
            Dim pm As New Project_Milestones_data
    
            Try
               
            Catch ex As Exception
             
            End Try
    
    
    
    
        End Sub
    End Class
  2. #2
    Hi,

    Please set RenderToForm="true" for the Menu
  3. #3
    Thank you this works, please mark this thread as closed.

    One of the biggest challenges I find with this frame work is understanding what settings I should be using for the various controls. In the case below I have spent several hours searching and looking at forum posts, and also looking at the documentation on Sencha trying many differing things but not finding the answer, in the end I came up with a work around which was to get the value of the date field as an extra parameter when the Ok button was clicked.

    I am wondering therefore if you have any suggestions / recommendations which would help people like myself (new to this framework) better understand it, so that I can spend more time developing, and less time searching forums etc when I run into an issue?

    I think the framework is excellent and it is only because of this that I have stuck with it and perservered with it, hoping for the eureka moment when it will all make sense...

    thanks in the meantime for your support.

Similar Threads

  1. Replies: 3
    Last Post: May 09, 2012, 4:28 PM
  2. I got priblem setting value to datefield
    By ranganath in forum 1.x Help
    Replies: 1
    Last Post: Feb 23, 2011, 2:03 PM
  3. Calendar setting incorrect date
    By flaviodamaia in forum 1.x Help
    Replies: 0
    Last Post: Oct 21, 2010, 11:23 AM
  4. Replies: 3
    Last Post: May 06, 2010, 12:48 PM
  5. setting the default value of a date type column of store from backend ?
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 2
    Last Post: Oct 16, 2009, 5:35 PM

Tags for this Thread

Posting Permissions