I'm trying to use the WebDateTimeEdit with a UltraWebGrid
I set the WebDateTimeEdit as the control of a columns grid...
When I put a date like 20/03/2008 (My system is dd/mm/yyyy) it's fine....but when I try to edit the value....the value turns blank....it seems the control have turned back to the culture mm/dd/yyyy and recognize that the month is > 12......but when I set the date to 20/03/2008 it allows again....
Another problem is when I put a date like 10/03/2008, this time when I try to edit the date it doesn't turn blank...but the date becomes 03/10/2008....and if I leave the edit mode and try to edit again, the value turns back into 10/03/2008....and this is a loop!!
Hi,
The culture of WebDateTimeEdit is defined by culture of CurrentThread on server. You also may customize particular editor using its Culture property. Culture or any "format" properties of grid do not affect editor.
Probe with this format...
wdteControl.EditModeFormat = "dd/MM/yyyy hh:mm tt";
I tried again to test WebDateTimeEdit with grid and it worked correctly. I could not reproduce swapped month/day fields.WebDateTimeEdit in aspx appeared as<igtxt:WebDateTimeEdit ID="WebDateTimeEdit1" runat="server" EditModeFormat="dd/MM/yyyy hh:mm tt"></igtxt:WebDateTimeEdit>It was assigned to grid byprotected void UltraWebGrid1_InitializeLayout(object sender, LayoutEventArgs e){ this.UltraWebGrid1.Columns[3].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom; this.UltraWebGrid1.Columns[3].EditorControlID = this.WebDateChooser1.UniqueID;}And grid was filled with datavoid UltraWebGrid1_InitializeDataSource(object sender, Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e){ DataTable dt = new DataTable("Customer"); dt.Columns.Add("CustomerID", typeof(int)); dt.Columns.Add("CustomerName", typeof(string)); dt.Columns.Add("Address", typeof(string)); dt.Columns.Add("DateOfJoin", typeof(DateTime)); dt.Rows.Add(new object[] { 2, "Walter Smith", "12/4 S MarkD", new DateTime(2009, 10, 20) }); ... this.UltraWebGrid1.DataSource = dt;}
I tested recently built dlls. That is possible that older versions of grid may have some issues. Please update NetAdvantage with latest service release.
In last response I accidentally pasted wrong line from my sample. It should bethis.UltraWebGrid1.Columns[3].EditorControlID = this.WebDateTimeEdit1.UniqueID;but notthis.UltraWebGrid1.Columns[3].EditorControlID = this.WebDateChooser1.UniqueID;
hi,
This solution is fine But if I want the date to be displayed as
Monday, December 31 2009 12:00:00 AM
Then what do I need to set for EditModeFormat property of WebDatetimeEdit.
Hi John,
The day of week is not support in edit mode. So, you may set DisplayModeFormat for that. Below is example:<igtxt:WebDateTimeEdit ID="WebDateTimeEdit1" runat="server" Width="250px" EditModeFormat="MM/dd/yyyy hh:mm:ss tt" DisplayModeFormat="dddd, MMMM dd yyyy hh:mm:ss tt"></igtxt:WebDateTimeEdit>