asp.net mvc - TimeSpan Datatype in not getting correct time while exporting to Excel -
i create 1 small project using timespan datatype in project trying login , logout time while exporting excel time not displaying in excel column. please me.
this code there use timespan.
public timespan punchin { get; set; } [notmapped] public string month { { var in = timezoneinfo.converttimefromutc(punchdate.date + punchin, timezoneinfo.findsystemtimezonebyid(user.registeredtimezone)); return in.tostring("mmmm"); } }
and kendo grid code.
@(html.kendo().grid(model) .name("timetrackinglogsgrid") .columns(columns => { columns.bound(c => c.id).hidden(true).htmlattributes(new {style="text-align:center;"}); columns.bound(c => c.isdeleted).hidden(true); columns.bound(c => c.approvalrequired).visible((bool)viewbag.isadmin).clienttemplate("# if (approvalrequired == true && approved == false && '"+ (viewbag.isadmin).tostring() + "'=== 'true') {# yes: <a data-ajax='true' data-ajax-complete='refreshgrid' data-ajax-method='post' href='/punch/approve/#:id#' class='grid-link' >approve</a>#} else{# no #}#"); columns.bound(c => c.employeename).filterable(ftb => ftb.multi(true).search(true)); columns.bound(c => c.month).hidden(true).filterable(ftb => ftb.multi(true)); columns.bound(c => c.punchdate) .clientfootertemplate("#= getformattddate(data.punchdate.min) # - #= getformattddate(data.punchdate.max) # ") .clientgroupheadertemplate("#:convetutcdatetolocaldate(punchdate)#").htmlattributes(new { @class = "utc-date", utc_date_value = "#:punchdate#" }); columns.bound(c => c.punchinpic).hidden(true).visible((bool)viewbag.isadmin).clienttemplate("<img class='punchpic' width='100' src='data: image / png; base64,#:punchinpic#'/>").htmlattributes(new { style="text-align:center;"}); columns.bound(c => c.punchin).groupable(false).filterable(false).clienttemplate("#:punchin.hours#:#:punchin.minutes#").htmlattributes(new { @class = "utc-time", utc_time_value = "#:punchin.hours#:#:punchin.minutes#" }); columns.bound(c => c.punchoutpic).hidden(true).visible((bool)viewbag.isadmin).clienttemplate("<img class='punchpic' width='100' src='data: image / png; base64,#:punchoutpic#'/>").htmlattributes(new { style = "text-align:center;" }); columns.bound(c => c.punchout).groupable(false).filterable(false).clienttemplate("#:punchout == null ? 0 :punchout.hours #:#: punchout == null ? 0 : punchout.minutes #").htmlattributes(new {@class= "utc-time", utc_time_value = "#: punchout == null ? 0 : punchout.hours#:#:punchout == null ? 0 : punchout.minutes #" }); columns.bound(c => c.duration).groupable(false).filterable(false) .clientfootertemplate("#= secondstotime(data.durationinseconds.sum) # ") .clienttemplate("#:formatduration(duration.hours,duration.minutes) #").htmlattributes(new { @class = "" }); columns.bound(c => c.comments).visible((bool)viewbag.isadmin).filterable(false).groupable(false).clienttemplate("# if (approvalrequired == true && approved == false && '" + (viewbag.isadmin).tostring() + "' !== 'true') {# please time log approved #} else{#<span class='comments' (#:comments# == null ? '' : title='<ul> #:comments# </ul>')> view <span>#}#"); columns.command(command => { // command.edit().text(" "); command.destroy().text(" "); }).width(50); }) .htmlattributes(new { @class = "full-screen-dashboard" }) //.scrollable() .groupable() .sortable() .filterable() .navigatable() .columnmenu() .toolbar(toolbar => { //toolbar.create(); //toolbar.save(); toolbar.pdf(); toolbar.excel(); toolbar.custom().text("clear filter").htmlattributes(new { @class= "cleargridfilter" }); }) .excel(exl=>exl.allpages(true).filterable(true).filename("timesheet.xlsx") .proxyurl(url.action("exportsave", "punch")))
Comments
Post a Comment