vb.net - DevExpress Report Label FormatString not working for Date -


i've been stuck trying solve problem few days ago no result, appreciated.

i retrieve date field database in format (dd/mm/yyyy hh:nn:ss am/pm) keep sorting , other purposes, , want display format in xtrareport in format (dd/mm/yyyy)

details: developing vb.net project includes devexpress reports. problem xtrareport includes date field among data, binding report's labels empty datatable in project's dataset, , fill datatable , bind report datatable in runtime. works great except using label's smarttag edit formatstring property doesn't seem have effect output result. please note don't want change source sql query format.

thanks, mohamed

if database return column values of datetime type can use binding.format set format of values.
here example:

dim datatable new datatable("data") datatable.columns.add("datetime", type.gettype("system.datetime"))  datatable.rows.add(new datetime(2003, 10, 5, 19, 12, 15)) datatable.rows.add(new datetime(1987, 1, 4, 11, 47, 53)) datatable.rows.add(new datetime(2010, 6, 25, 7, 25, 14))  dim label new xrlabel() label.databindings.add(new xrbinding("text", nothing, "datetime", "{0:dd'/'mm'/'yyyy}"))  dim detail new detailband() detail.controls.add(label)  dim report new xtrareport() report.bands.add(detail)  report.datasource = datatable  dim tool new reportprinttool(report) tool.showribbonpreview() 

if database return column values of string type can use calculatedfield , substring function in expression.
here example:

dim datatable new datatable("data") datatable.columns.add("datetimestring", type.gettype("system.string"))  datatable.rows.add("05/10/2003 19:12:15") datatable.rows.add("04/01/1987 11:47:53") datatable.rows.add("25/06/2010 07:25:14")  dim calculatedfield new calculatedfield() calculatedfield.name = "datetime" calculatedfield.expression = "substring(datetimestring,0,10)"  dim label new xrlabel() label.databindings.add(new xrbinding("text", nothing, "datetime"))  dim detail new detailband() detail.controls.add(label)  dim report new xtrareport() report.bands.add(detail)  report.datasource = datatable  report.calculatedfields.add(calculatedfield)  dim tool new reportprinttool(report) tool.showribbonpreview() 

the result:
the result


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -