I have an UltraGrid and one of the columns is for user to enter Date in the format of "yyyy-mm-dd" (eg. "2010-08-09"). So I set the column to do that as below:
column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Date;
column.MaskInput = "yyyy-mm-dd";
column.Format =
"yyyy-mm-dd";
The display and editing works just fine. The problem is after user finished editing, I need to retreive the date in that format. So I used the following code:
string
dateValue = grid.Rows[0].Cells["MyDateCol"].Value.ToString();
The "dateValue" output is "8/9/2010 12:00:00 AM", which is not formatted and also includes the time. I only want the formatted date which should be "2010-08-09". So how to retrieve that formatted date?
Thanks!
The Value property on the column will return to you a DateTime variable. So if you want to format the date, you could pass the format into the ToString method to get a formatted string.
Another option would be to use the Text property of the cell instead of Value.
Hi,
I am binding my ultra win grid with dataset. In dataset, i have field DOJ(Datetime).
now i want to show only date part in my DOJ column in grid.
How i can do that? I have already used Format and mask input but its not working.
Please help me.