This project is read-only.

SortableListFor with DateTimeFor

Jun 21, 2011 at 8:18 PM

Hi, I'm with a problem in "DateTimeFor" using jQuery. I have this model:

public class AtividadeInserirViewModel
{
        [Required]
        public int atv_relatorio { get; set; }
        public List<AtividadeInserirView> Atividades { get; set; }
}
public class AtividadeInserirView
{
        [Required]
        public string atv_titulo { get; set; } 
        public System.DateTime atv_datafim { get; set; }
}

And in the view:

@model NLayerApp.Presentation.Web.MVC.Client.Models.AtividadeInserirViewModel
(...)
  @Html.LabelFor(model => model.atv_relatorio)
  @Html.EditorFor(model => model.atv_relatorio, new { Lookup = Model.lookupRelatorio})
  @Html.ValidationMessageFor(model => model.atv_relatorio)
@helper InsertAtividade(HtmlHelper<AtividadeInserirView> Html)
{        
        @Html.EditorFor(model => model.atv_titulo)
        @{var DtFim = Html.DateTimeFor(m => m.atv_datafim, DateTime.Now, true);}
        @DtFim.DateCalendar()           
}
 @Html.SortableListFor(m => m.Atividades,
          _S.H<AtividadeInserirView>(h => InsertAtividade(h)),
                canSort: true,
                allItemsContainer: ExternalContainerType.ol,
                itemContainer: ExternalContainerType.li,
                htmlAttributesContainer: new Dictionary<string, object>() { {"class" , "SortableList"} })
            @Html.SortableListAddButtonFor(m => m.Atividades,
                "Inserir",
                ManipulationButtonStyle.Button,
                new Dictionary<string, object>() { { "class", "DataButtonInsert" } })

When the view is called the model has one item in "Model.Atividades", and this item show the jQuery calendar for "atv_datafim" normaly. But if I add new items to "Model.Atividades" the calendar is not showed for the new items. How I fix this? Thanks!

Coordinator
Jun 22, 2011 at 1:18 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.