javascript - ASP.Net MVC4 using Jquery DatePicker -
i not in mvc , exploring asp.net mvc 4 lately working on academic project. using jquery datepicker deal date fields .
i have added 2 fields
@using (html.beginform()) { @html.validationsummary(true) <fieldset> <legend>periode</legend> <div class="editor-label"> @html.labelfor(model => model.starttime) </div> <div class="editor-field"> @html.editorfor(model => model.starttime) @html.validationmessagefor(model => model.starttime) </div> <div class="editor-label"> @html.labelfor(model => model.endtime) </div> <div class="editor-field"> @html.editorfor(model => model.endtime) @html.validationmessagefor(model => model.endtime) </div> </fieldset> } @using (html.beginform()) { <p> <input type="submit" value="show" /> </p> <p> @html.actionlink("back list", "index") </p> } this got http://i.stack.imgur.com/rome1.jpg
now got 2 vals , wanna create action whenever hit "show" , using model (so need jump page )
well , still not in mvc architecture . how can pass data , use in other action !
[httppost] public actionresult index(periode model ) { //i thin keep empty , need getting 2 vals return view(); } [httppost, actionname("show")] public actionresult showingdata(int id = 0) { // here neeed deal data work in query var clients = s in db.clients select s; // bla bla return redirecttoaction("index"); } update ! think it's better using 2 field better building model 2 fields (min/max)
one last question , how can use values in controller (c# code) , how can pass data , problem mvc ! still beginner .
html: <label for="from">from</label> <input type="text" id="from" name="from"/> <label for="to">to</label> <input type="text" id="to" name="to"/> javascript: $(function() { $("#from").datepicker({ defaultdate: "+1w", changemonth: true, numberofmonths: 3, onselect: function( selecteddate ) { $( "#to" ).datepicker( "option", "mindate", selecteddate ); } }); $("#to").datepicker({ defaultdate: "+1w", changemonth: true, numberofmonths: 3, onselect: function( selecteddate ) { $( "#from" ).datepicker( "option", "maxdate", selecteddate ); } }); }); i appreciate
Comments
Post a Comment