c# - Getting value from jquery datetimepicker in MVC -


im playing around booking-system in mvc. have view select 3 diffrent values (treatment, hairdresser , date).

@using (html.beginform("testing", "home", formmethod.post)) {  <p id="frisor"> frisör: @html.dropdownlist("fris", "all")<a class="butt" onclick="showdiv()">nästa steg</a></p> <p id="behandling">behandling: @html.dropdownlist("cat", "all")<a class="butt" onclick="showdiv2()">nästa steg</a></p>  <p>     datum:     <input type="text" id="mydate" />    <-------this jquery datetimepicker </p 

i save customers 3 choices in 3 properties have created. post method looks this:

[httppost]         public actionresult testing(string fris, string cat, datetime mydate)         {             kv.treatment = cat             kv.hairdresser = fris;             kv.datum = mydate;             return view();         } 

i 2 first (hairdresser,treatment) fine, problem dont know how value jquery datetimpicker. appreciated!

the input needs name in order included in form post:

<input type="text" id="mydate" name="mydate" /> 

otherwise browser won't include in posted data, never reach server model binding. (and, of course, name has match method argument name model binder match them.)


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -