asp.net mvc - MVC TimeSpan Value Not Returning To Controller -


when attempt post data database, time values not in model. display fine when retrieving data though.

here model:

public class schedule {     [displayname("build time")]     [displayformat(applyformatineditmode = true, dataformatstring = @"{0:hh\:mm}")]     public timespan build_time { get; set; }      [displayname("start time")]     [displayformat(applyformatineditmode = true, dataformatstring = @"{0:hh\:mm}")]     public timespan call_start_time { get; set; }      [displayname("end time")]     [displayformat(applyformatineditmode = true, dataformatstring = @"{0:hh\:mm}")]     public timespan call_end_time { get; set; }     

post controller:

    // post: recurringtemplate/create     [httppost]     public actionresult create(recurringtemplate recurringtemplate)     {         try         {             _repo.addrecurringtemplate(recurringtemplate);              return redirecttoaction("index");         }         catch         {             return view();         }     }    

view objects: (the model viewmodel schedule class in)

           @html.labelfor(model => model.schedule.build_time)            <span class="glyphicon glyphicon-time"></span>            @html.editorfor(model => model.schedule.build_time, new {htmlattributes = new {@class = "form-control"}})               @html.labelfor(model => model.schedule.call_start_time)              <span class="glyphicon glyphicon-time"></span>             @html.editorfor(model => model.schedule.call_start_time, new {htmlattributes = new {@class = "form-control"}})             @html.validationmessagefor(model => model.schedule.call_start_time, "", new {@class = "text-danger"})              @html.labelfor(model => model.schedule.call_end_time)             <span class="glyphicon glyphicon-time"></span>             @html.editorfor(model => model.schedule.call_end_time, new {htmlattributes = new {@class = "form-control"}}) 

all of other controls have view posting no problem, can't time return. shows {00:00:00} times in debugger.

any appreciated!

here view model schedule class in:

    public class recurringtemplate {     public schedule schedule { get; set; }     public list<filters> filters { get; set; }     public list<builddays> builddays { get; set; }     public list<offsets> offsets { get; set; }     public list<scheduletypes> scheduletypes { get; set; }      [required(errormessage = "please select builddays")]     public list<byte> selectedbuilddays { get; set; }      public byte selectedscheduletype { get; set; }     public decimal filterid { get; set; } } 

edit have found issue, , apologize didn't realize left part out initially. have custom ui time picking datetimepicker... , if remove javascript values returning controller:

    @* time picker *@ <script type="text/javascript">     $(document).ready(function () {         $("#schedule_build_time").datetimepicker({             format: "lt"          });     }); </script>     

any ideas or experience this?


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -