locked
DateAjaxCalendar not working RRS feed

  • Question

  • User-1759624489 posted

     I am back with this problem.

     

    I noticed that the ajax calendar worked on one page but didnt work on other.

     

    Working page:

    - Holidays table

    Columns: Id, Date, Description

     

     

    Non-Working Page

    - Contract table

    id, Name, StartDate,EndDate, FilePath

     

    The contract table has a fileupload field template,

     

    I think that may be the reason,  please tell me which code should I paste here because its too long.

     

    NON WORKING

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Web.DynamicData;
    using System.Xml.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Data;
    using System.ComponentModel.DataAnnotations;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.ComponentModel;
    using Microsoft.Web.DynamicData;
    using Sodexo.Data;

    namespace Sodexo.Entities         
    {
        [MetadataType(typeof(ContractMetaData))] 
        public  partial class Contract
        {

        }

        [DisplayName("Contratos")]
        public class ContractMetaData
        {
            public object ContractId { get; set; }

            [DisplayName("Nombre")]
            [Required(ErrorMessage = "Este campo es Requerido")]
            public object Name { get; set; }

            [DisplayName("Descripcion")]
            [Required(ErrorMessage = "Este campo es Requerido")]
            public object Description { get; set; }

            [DisplayName("Fecha Inicio Contrato")]
            //[UIHint("DateTime")]
            [UIHint("DateAjaxCalendar")]
            [Required(ErrorMessage = "Este campo es Requerido")]
            [DisplayFormat(DataFormatString = "{0:dd-MMM-yyyy}")]
            public object StartDate { get; set; }

            [DisplayName("Fecha Fin Contrato")]
            [Required(ErrorMessage = "Este campo es Requerido")]
            //[UIHint("DateTime")]
            [UIHint("DateAjaxCalendar")]
            [DisplayFormat(DataFormatString = "{0:dd-MMM-yyyy}")]
            public object EndDate { get; set; }

            [DisplayName("Archivo PDF del Contrato")]
            [UIHint("FileImage")]
            [Required(ErrorMessage = "Este campo es Requerido")]
            public object DocumentPath { get; set; }

            [DisplayName("Activos del contrato")]
            public object ContractAssets { get; set; }

            [DisplayName("Proveedor")]
            public object Supplier { get; set; }


       
        }
    }

     

     

    WORKING

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Web.DynamicData;
    using System.Xml.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Data;
    using System.ComponentModel.DataAnnotations;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.ComponentModel;
    using Sodexo.Data;

    namespace Sodexo.Entities
    {
        [MetadataType(typeof(HolidayMetadata))]   
        public partial class Holiday
        {

        }

        [DisplayName("Días Festivos")]
        public class HolidayMetadata
        {
            public object Id { get; set; }

            [Required(ErrorMessage = "Este campo es requerido.")]
            [DisplayName("Fecha")]
            [UIHint("DateAjaxCalendar")]
            [DisplayFormat(DataFormatString="{0:dd-MMM-yyyy}",  ApplyFormatInEditMode = true)]
            public object Date { get; set; }

            [Required(ErrorMessage = "Este campo es requerido.")]
            [DisplayName("Descripcion")]
            public object Description { get; set; }





       
        }
    }
     

    Tuesday, September 16, 2008 10:03 AM

Answers

  • User-330204900 posted

    I the only major differenct I could see was the registration of the userControl

    <%@ Register src="../../../UserControls/ServerErrorMessage.ascx" tagname="ServerErrorMessage" tagprefix="uc1" %>

    Which I could not see being used. If it were me I would copy the working page to the location of the failing page and try that with its minor alterations and see if was the page as the metadata seem ok.

    [:D]

    steve

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 16, 2008 1:34 PM
  • User1641955678 posted

    Indeed, the way to investigate these issues is by reducing the repro scenario.  e.g. start from the failing page, and remove everything except what's relevant to the situation.  In the act of doing this, you will likely locate the root of the issue.

    thanks,
    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 17, 2008 10:47 AM
  • User-1759624489 posted

    I copied the working  page into the nonworking page. And I must say that it finally worked.

     

    I just cant find the reason why!!

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 17, 2008 5:35 PM

All replies

  • User-330204900 posted

    If you have a FileUpload on the page what that will cause to happen is that the Partial Render will be disabled on that page but that should not affect the Calendar control as this does not rely upon the update pannel just the script manager.

    Also are any of the other attributes working where your ajax calendar fails?

    Hope this helps [:D]

    Tuesday, September 16, 2008 10:57 AM
  • User-1759624489 posted

    This is the listdetails.aspx for the contract table.

     

    I dont see anything special here

     

    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" CodeFile="ListDetails.aspx.cs" Inherits="ListDetails" %>

    <%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>
    <%@ Register src="~/DynamicData/Content/FilterUserControl.ascx" tagname="DynamicFilter" tagprefix="asp" %>

    <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" />

        <cc1:AnimationExtender ID="DynamicDataManager1_AnimationExtender"
            runat="server" TargetControlID="DynamicDataManager1">
        </cc1:AnimationExtender>


        <h2>Contratos<%--<%= GridDataSource.GetTable().DisplayName %>--%></h2>


        <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" />

      
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <br />
                <table style="width: 100%">
                    <tr>
                        <td align="center">
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server"
                                EnableClientScript="true" HeaderText="Errores de validación:"  ShowSummary="false"/>
                            <asp:DynamicValidator ID="GridViewValidator" runat="server"
                                ControlToValidate="GridView1" Display="None" />
                            <asp:DynamicValidator ID="DetailsViewValidator" runat="server"
                                ControlToValidate="DetailsView1" Display="None" />
                            <asp:FilterRepeater ID="FilterRepeater" runat="server">
                                <ItemTemplate>
                                    <asp:Label runat="server" AssociatedControlID="DynamicFilter$DropDownList1"
                                        Text='<%# Eval("DisplayName") %>' />
                                    <asp:DynamicFilter ID="DynamicFilter" runat="server"
                                        OnSelectedIndexChanged="OnFilterSelectedIndexChanged" />
                                </ItemTemplate>
                                <FooterTemplate>
                                    <br />
                                    <br />
                                </FooterTemplate>
                            </asp:FilterRepeater>
                            <asp:DetailsView ID="DetailsView1" runat="server"
                                DataSourceID="DetailsDataSource" DefaultMode="Insert"
                                OnItemDeleted="OnDetailsViewItemDeleted"
                                OnItemInserted="OnDetailsViewItemInserted"
                                OnItemUpdated="OnDetailsViewItemUpdated"
                                OnModeChanging="OnDetailsViewModeChanging" OnPreRender="OnDetailsViewPreRender"
                                style="text-align: center" DataKeyNames="Id" Width="100%">
                                <RowStyle CssClass="row" />
                                <Fields>
                                    <asp:TemplateField ShowHeader="False">
                                        <InsertItemTemplate>
                                            <asp:Button ID="Button1" runat="server" CausesValidation="True"
                                                CommandName="Insert" CssClass="submit" Text="Insertar" />
                                            &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False"
                                                CommandName="Cancelar" CssClass="submit" Text="Cancelar" />
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                            <asp:Button ID="Button1" runat="server" CausesValidation="False"
                                                CommandName="New" CssClass="submit" Text="Nuevo" />
                                        </ItemTemplate>
                                         <EditItemTemplate>
                                            <asp:Button ID="Button1" runat="server" CausesValidation="True"
                                                CommandName="Update" CssClass="submit" Text="Actualizar" />
                                            &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False"
                                                CommandName="Cancel" CssClass="submit" Text="Cancelar" />
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                                <HeaderStyle CssClass="tableHead" />
                                <AlternatingRowStyle CssClass="formAlternateRow" />
                            </asp:DetailsView>
                            <br />
                            <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
                                AllowSorting="True" AutoGenerateColumns="False" DataSourceID="GridDataSource"
                                OnDataBound="OnGridViewDataBound" OnRowCreated="OnGridViewRowCreated"
                                OnRowDeleted="OnGridViewRowDeleted" OnRowEditing="OnGridViewRowEditing"
                                OnRowUpdated="OnGridViewRowUpdated"
                                OnSelectedIndexChanging="OnGridViewSelectedIndexChanging"
                                style="text-align: center; margin-right: 1px;" Width="100%"
                                onselectedindexchanged="GridView1_SelectedIndexChanged">
                                <RowStyle CssClass="row" />
                                <Columns>
                                    <asp:DynamicField DataField="Name"  HeaderText="Nombre"/>
                                    <asp:DynamicField DataField="StartDate" HeaderText="Fecha Inicial" />
                                    <asp:DynamicField DataField="EndDate" HeaderText="Fecha Final" />
                                    <asp:DynamicField DataField="DocumentPath" HeaderText="Contrato" />
                                   
                                   
                                    <%--<asp:CommandField ButtonType="Image" CancelText="Cancelar"
                                        DeleteImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png"
                                        DeleteText="Eliminar"
                                        EditImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoEdit.png" EditText="Editar"
                                        InsertText="Insertar" NewText="Nuevo" SelectText="Seleccionar"
                                        ShowEditButton="True" UpdateText="Actualizar" ShowDeleteButton="True"
                                        UpdateImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png" />                             
                                    --%>
                                      <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton  CommandName="Select" CausesValidation="false" ID="EditButton" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoEdit.png" runat="server" NavigateUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>'    Text="Editar" ToolTip="Editar"  />
                                            <asp:ImageButton  CommandName="Delete" CausesValidation="false" ID="DeleteButton1" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png" runat="server"     Text="Eliminar" ToolTip="Eliminar"  OnClientClick='return confirm("Esta seguro que desea eliminar esta regional");' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:ImageButton CommandName="Update" CausesValidation="true" ID="EditButton" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoEdit.png" runat="server" NavigateUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>'    Text="Actualizar"  ToolTip="Actualizar"  />
                                            <asp:ImageButton CommandName="Cancel" CausesValidation="false" ID="DeleteButton1" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png" runat="server" NavigateUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>'    Text="Cancelar"  ToolTip="Cancelar" />
                                        </EditItemTemplate>
                                    </asp:TemplateField>                               
                                </Columns>
                                <HeaderStyle CssClass="tableHead" />
                                <PagerTemplate>
                                    <asp:GridViewPager runat="server" />
                                </PagerTemplate>
                                <EmptyDataTemplate>
                                    No se encuentran registros.
                                </EmptyDataTemplate>
                                <AlternatingRowStyle CssClass="alternateRow" />
                            </asp:GridView>
                            <br />
                        </td>
                    </tr>
                </table>
                <br />

                <asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true">
                    <WhereParameters>
                        <asp:DynamicControlParameter ControlID="FilterRepeater" />
                    </WhereParameters>
                </asp:LinqDataSource>

                <asp:Panel ID="DetailsPanel" runat="server">
                  <br /><br />

                  <asp:LinqDataSource ID="DetailsDataSource" runat="server" EnableDelete="true" EnableInsert="true" EnableUpdate="true">
                      <WhereParameters>
                          <asp:DynamicControlParameter ControlID="GridView1" />
                      </WhereParameters>
                  </asp:LinqDataSource>
                </asp:Panel>
        

            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Content>
     

    Tuesday, September 16, 2008 11:03 AM
  • User-330204900 posted

    Is this the same page as the one that works or is one a custom page?

    Tuesday, September 16, 2008 11:08 AM
  • User-1759624489 posted

    Its a custom page but its almost the same, except for the title I think

     

    The one that works is:

     

    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" CodeFile="ListDetails.aspx.cs" Inherits="CustomPages.Regionals.ListDetails" %>

    <%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>
    <%@ Register src="~/DynamicData/Content/FilterUserControl.ascx" tagname="DynamicFilter" tagprefix="asp" %>

    <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

    <%@ Register src="../../../UserControls/ServerErrorMessage.ascx" tagname="ServerErrorMessage" tagprefix="uc1" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" />
      <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" />

      
        <br />


        <h2>Días Festivos<%--<%= GridDataSource.GetTable().DisplayName %>--%></h2>

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <br />
                <table style="width: 100%">
                    <tr>
                        <td align="center">
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server"
                                EnableClientScript="true" HeaderText="Errores de validación:"
                                ShowSummary="False"  />
                               
                            <asp:DynamicValidator ID="GridViewValidator" runat="server"
                                ControlToValidate="GridView1" Display="None" />
                               
                            <asp:DynamicValidator ID="DetailsViewValidator" runat="server"
                                ControlToValidate="DetailsView1" Display="None" />
                               
                            <cc1:ValidatorCalloutExtender  ID="ValidatorCallOutExtender1" runat="server" TargetControlID="DetailsViewValidator"></cc1:ValidatorCalloutExtender>

     

                            <asp:FilterRepeater ID="FilterRepeater" runat="server">
                                <ItemTemplate>
                                    <asp:Label runat="server" AssociatedControlID="DynamicFilter$DropDownList1"
                                        Text='<%# Eval("DisplayName") %>' />
                                    <asp:DynamicFilter ID="DynamicFilter" runat="server"
                                        OnSelectedIndexChanged="OnFilterSelectedIndexChanged" />
                                </ItemTemplate>
                                <FooterTemplate>
                                    <br />
                                    <br />
                                </FooterTemplate>
                            </asp:FilterRepeater>
                     
                            <asp:Label ID="lblError" runat="server" CssClass="errors"
                                EnableViewState="false" Visible="false" />
                     
                            <br />
                            <asp:DetailsView ID="DetailsView1" runat="server"
                                DataSourceID="DetailsDataSource" DefaultMode="Insert"
                                OnItemDeleted="OnDetailsViewItemDeleted"
                                OnItemInserted="OnDetailsViewItemInserted"
                                OnItemUpdated="OnDetailsViewItemUpdated"
                                OnModeChanging="OnDetailsViewModeChanging" OnPreRender="OnDetailsViewPreRender"
                                style="text-align: left" DataKeyNames="Id"
                                Width="100%" GridLines="None">
                                <FooterStyle CssClass="row" />
                                <RowStyle CssClass="row"  />
                                <Fields>
                                    <asp:TemplateField ShowHeader="False">
                                        <InsertItemTemplate>
                                            <asp:Button ID="Button1" runat="server" CausesValidation="True"
                                                CommandName="Insert" CssClass="submit" Text="Insertar" />
                                            &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False"
                                                CommandName="Cancelar" CssClass="submit" Text="Cancelar" />
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                            <asp:Button ID="Button1" runat="server" CausesValidation="False"
                                                CommandName="New" CssClass="submit" Text="Nuevo" />
                                        </ItemTemplate>
                                         <EditItemTemplate>
                                            <asp:Button ID="Button1" runat="server" CausesValidation="True"
                                                CommandName="Update" CssClass="submit" Text="Actualizar" />
                                            &nbsp;<asp:Button ID="Button2" runat="server" CausesValidation="False"
                                                CommandName="Cancel" CssClass="submit" Text="Cancelar" />
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                </Fields>
                            
                                <AlternatingRowStyle CssClass="formAlternateRow" />
                            </asp:DetailsView>
                            <br />
                            <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
                                AllowSorting="True" AutoGenerateColumns="False" DataSourceID="GridDataSource"
                                OnDataBound="OnGridViewDataBound" OnRowCreated="OnGridViewRowCreated"
                                OnRowDeleted="OnGridViewRowDeleted" OnRowEditing="OnGridViewRowEditing"
                                OnRowUpdated="OnGridViewRowUpdated"
                                OnSelectedIndexChanging="OnGridViewSelectedIndexChanging"
                                style="text-align: center; margin-right: 1px;" Width="100%"
                                onrowcancelingedit="GridView1_RowCancelingEdit" GridLines="None"
                                onselectedindexchanged="GridView1_SelectedIndexChanged">
                                <RowStyle CssClass="row" />
                                <Columns>
                                    <asp:DynamicField DataField="Id" HeaderText="Id"/>
                                    <asp:DynamicField DataField="Date" HeaderText="Fecha"/>
                                    <asp:DynamicField DataField="Description" HeaderText="Descripción"/>
                                  
                                      <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton  CommandName="Select" CausesValidation="false" ID="EditButton" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoEdit.png" runat="server"     Text="Editar" ToolTip="Editar"  />
                                            <asp:ImageButton  CommandName="Delete" CausesValidation="false" ID="DeleteButton1" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png" runat="server"     Text="Eliminar" ToolTip="Eliminar"  OnClientClick='return confirm("Esta seguro que quiere eliminar este registro?");' />
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:ImageButton CommandName="Update" CausesValidation="true" ID="EditButton" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoEdit.png" runat="server"     Text="Actualizar"  ToolTip="Actualizar"  />
                                            <asp:ImageButton CommandName="Cancel" CausesValidation="false" ID="DeleteButton1" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png" runat="server"     Text="Cancelar"  ToolTip="Cancelar"  />
                                        </EditItemTemplate>
                                    </asp:TemplateField>                                
                                     
                                </Columns>
                                <HeaderStyle CssClass="tableHead" />
                                <PagerTemplate>
                                    <asp:GridViewPager runat="server" />
                                </PagerTemplate>
                                <EmptyDataTemplate>
                                    No se encontraron registros.
                                </EmptyDataTemplate>
                                <AlternatingRowStyle CssClass="alternateRow" />
                            </asp:GridView>
                            <br />
                        </td>
                    </tr>
                </table>
                <br />

                <asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true">
                    <WhereParameters>
                        <asp:DynamicControlParameter ControlID="FilterRepeater" />
                    </WhereParameters>
                </asp:LinqDataSource>

                <asp:Panel ID="DetailsPanel" runat="server">
                  <br /><br />

                  <asp:LinqDataSource ID="DetailsDataSource" runat="server" EnableDelete="true" EnableInsert="true" EnableUpdate="true">
                      <WhereParameters>
                          <asp:DynamicControlParameter ControlID="GridView1" />
                      </WhereParameters>
                  </asp:LinqDataSource>
                </asp:Panel>

     
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Content>
     

    Tuesday, September 16, 2008 11:13 AM
  • User-330204900 posted

    I the only major differenct I could see was the registration of the userControl

    <%@ Register src="../../../UserControls/ServerErrorMessage.ascx" tagname="ServerErrorMessage" tagprefix="uc1" %>

    Which I could not see being used. If it were me I would copy the working page to the location of the failing page and try that with its minor alterations and see if was the page as the metadata seem ok.

    [:D]

    steve

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 16, 2008 1:34 PM
  • User1641955678 posted

    Indeed, the way to investigate these issues is by reducing the repro scenario.  e.g. start from the failing page, and remove everything except what's relevant to the situation.  In the act of doing this, you will likely locate the root of the issue.

    thanks,
    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 17, 2008 10:47 AM
  • User-1759624489 posted

    I copied the working  page into the nonworking page. And I must say that it finally worked.

     

    I just cant find the reason why!!

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 17, 2008 5:35 PM
  • User-330204900 posted

    Well there you go it only takes one spelling mistake to boom, hope it's all working fine for you now [:D]

    Wednesday, September 17, 2008 5:47 PM