Click here to Skip to main content
15,899,937 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have the following codes which the table cell value is bind with a dataset value. On this cell is a date but the display would followed by time. I have tried the following but it seems like didnt work. Below are my codes:

C#
this.xrTableCell26.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {new DevExpress.XtraReports.UI.XRBinding("Text", null, "GetAgingCustomizationDetailedInfos.DateSpecReceived", "{0:dd-MM-yyyy}")});
    this.xrTableCell26.Font = new System.Drawing.Font("Arial", 10F);
    this.xrTableCell26.Name = "xrTableCell26";
    this.xrTableCell26.StylePriority.UseFont = false;
    this.xrTableCell26.StylePriority.UseTextAlignment = false;
    this.xrTableCell26.Text = "xrTableCell26";
    this.xrTableCell26.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
    this.xrTableCell26.Weight = 0.9349493423361247D;
Posted
Comments
DamithSL 16-Jun-14 1:03am    
how you get data?
Jamie888 16-Jun-14 2:05am    
from a dataset which i created. There is a stored procedure in SQL Server. Then in the report i just bind the table cell with the dataset's value which is the DateSpecReceived.

Hello friend, string.Format() is a function which can be used to represent a DateTime object in a specific Date format. Try the following code:

C#
string currentDate = string.Format("{0:dd-MM-yyyy}", DateTime.Now);
Response.Write(currentDate); //16-06-2014

Note: If you pass a string instead of a DateTime object, the format will not be applicable.
- DD
 
Share this answer
 
Comments
Jamie888 16-Jun-14 2:06am    
thks for your suggestion but FIY, the output should be displayed on a report's table cell.
.FormatString function can do this 4 u...
i.e
.FormatString = "{0;d}";
this will show only date in the table cells
Regards..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900