asp.net mvc 3 - JSon Date Format issue in MVC -


asp.net-mvc knockout mvc. screen should show empty text box. button. when user clicks button stored date should display in text box.

atm when screen loads date stored in text box '0001-01-01t00:00:00' when press button changes to: /date(1366300981661)/.

anyone have idea why this, , how can display date when button clicked.

please see code below: model

public class clickcountermodel     {      public void showdates()         {             firstdate = datetime.now;         }     } 

controller

public class clickcountercontroller : knockoutcontroller     {         public actionresult showdates(clickcountermodel model)         {             model.showdates();             return json(model);         }     } 

view

@using perpetuumsoft.knockout @model clickcounter.models.clickcountermodel @{   var ko = html.createknockoutcontext(); }  <div>dates: @ko.html.textbox(m => m.firstdate) </div> @ko.html.button("show", "showdates", "clickcounter")    @ko.apply(model) 

formatting of date missing after results fetched in json format.

jquery

var mydate_string_value = "/date(1366300981661)/"; var value = new date             (                  parseint(mydate_string_value.replace(/(^.*\()|([+-].*$)/g, ''))             ); var dat = value.getmonth() +                           1 +                         "/" +             value.getdate() +                         "/" +         value.getfullyear(); 

click here check result - 4/18/2013


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -