asp.net mvc - pass a DateTime value using Jquery to Action method -


i trying pass datetime value using jquery controller showing me error

the parameters dictionary contains null entry parameter 'fromdate' of non-nullable type 'system.datetime' method 'system.web.mvc.actionresult report(system.string, system.string, system.datetime, system.datetime, int32, int32, int32)' while debugging getting value. generating report can not able sort out . please problem.

view

<a href="@url.action("report", new { id = "pdf" })" class="btn-primary" id="exportbutton"> export pdf&nbsp;<i class="glyphicon glyphicon-print"></i></a>&nbsp;   @html.textboxfor(m => m.fromdate, new { @readonly = true, @class = "date-picker form-control" })  @html.textboxfor(m => m.todate, new { @readonly = true, @class = "date-picker form-control" })       $('#exportbutton').click(function () {             var accounttype = $('#selectedaccounttype').val();              var fromdate = $('#fromdate').val();             var todate = $('#todate').val();             var accountid = $('#selectedaccount').val();             var userid = $('#selecteduser').val();              var teamid = $('#selectedteam').val();             var id = "pdf";             $.post(                 '@url.action("report", "reports")',                 { id: id, selectedaccounttype: accounttype, fromdate: fromdate, todate: todate, selectedaccount: accountid, selecteduser: userid, selectedteam: teamid },                  function (data) {                  });         }); 

controller

public actionresult report(string id, string selectedaccounttype, datetime fromdate, datetime todate, int selectedaccount, int selectedteam, int selecteduser)         {             localreport lr = new localreport();             string path = path.combine(server.mappath("~/report"), "reportlist1.rdlc");             if (system.io.file.exists(path))             {                 lr.reportpath = path;             }             else             {                 return view("index");             }             var orderinfolist = reportservice.getreportslist(selectedaccounttype, fromdate, todate, selectedaccount, selectedteam, selecteduser);             reportdatasource rd = new reportdatasource("mydataset", orderinfolist);             lr.datasources.add(rd);             string reporttype = id;             string mimetype;             string encoding;             string filenameextension;             string deviceinfo = "<deviceinfo>" +             "  <outputformat>" + id + "</outputformat>" +             "  <pagewidth>8.5in</pagewidth>" +             "  <pageheight>11in</pageheight>" +             "  <margintop>0.5in</margintop>" +             "  <marginleft>0.5in</marginleft>" +             "  <marginright>0.5in</marginright>" +             "  <marginbottom>0.5in</marginbottom>" +             "</deviceinfo>";              warning[] warnings;             string[] streams;             byte[] renderedbytes;              renderedbytes = lr.render(                 reporttype,                 deviceinfo,                 out mimetype,                 out encoding,                 out filenameextension,                 out streams,                 out warnings);             return file(renderedbytes, mimetype);         } 

any appreciated

try this:

$('#exportbutton').click(function () {       var accounttype = $('#selectedaccounttype').val();        var fromdate = new date($('#fromdate').datepicker('getdate'));//get datepicker, selected date.       var todate = new date($('#todate').datepicker('getdate'));       var accountid = $('#selectedaccount').val();       var userid = $('#selecteduser').val();        var teamid = $('#selectedteam').val();       var id = "pdf";       $.post(            '@url.action("report", "reports")',             { id: id, selectedaccounttype: accounttype, fromdate: fromdate, todate: todate, selectedaccount: accountid, selecteduser: userid, selectedteam: teamid },             function (data) {       }); }); 

Comments



  1. iFind Data Recovery Enterprise Crack>I am very impressed with your post because this post is very beneficial for me and provide a new knowledge to me

    ReplyDelete
  2. Many thanks for making the effort to talk about this, I feel strongly about this and love learning a great deal more on this subject
    Such a Nice post. Thanks for Awesome tips Keep it up.
    Rubyinstaller Crack
    Artisteer Crack
    iFind Data Recovery Enterprise Crack
    TechTool Pro Crack
    SAM Broadcaster PRO Crack >
    Avocode Crack

    ReplyDelete

Post a Comment

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -