Hi all, i have succesfully added a webdatetimeeditor to a column on my grid, however when i click out to change the value of the cell, the value is restored to the previous value client side, how to i stop this happpening?
Hi,
My previous replay was for your previous post. In your codes I noticed that EditModeText is used. That is probably the reason for misbehavior. If WebDateTimeEdit is used as grid editor, then grid gets/sets Value as javascript Date object and if WebDateTimeEditor is configured to get/set string for its Value, then editor can be initialized with wrong value and it will return wrong Value to grid on end edit mode.
Please use default for DateMode property. Also, Nullable property is designed for a stand alone editor, it is better to keep default for that property too.
Please check if grid on client uses WebDateTimeEdit, but not default editor: if you can enter letters and other characters, then editor is not WebDateTimeEditor because grid did not find it on client. If it is the case, then the reason can be not correct value for column.ControlEditorID, or editor was not added to Form.Controls, but to some other container.
Also check if WebDateTimeEditor.EditModeFormat="hh:mm" is used, but not by column.Format="hh:mm".
If all is correct, then that issue is beyond forums. I suggest you to build a simple sample which reproduces that issue and submit a bug report: http://es.infragistics.com/support/ask-for-help.aspx
this is my modified code to reproduce:
protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) { DataTable dt = new DataTable(); dt.Columns.Add("TodaysDate", typeof(DateTime));
for (int i = 0; i < 100; i++) { DataRow row = dt.NewRow(); row["TodaysDate"] = DateTime.Now.AddDays(i); dt.Rows.Add(row); } //System.Threading.Thread.CurrentThread.CurrentCulture = Karjeni.Portal.KarjeniPage.getCulture(HttpContext.Current);
UltraWebGrid1.DataSource = dt; UltraWebGrid1.DataBind();
this.WebDateTimeEdit1.DataMode = Infragistics.WebUI.WebDataInput.DateDataMode.EditModeText; this.WebDateTimeEdit1.DisplayModeFormat = "g"; this.WebDateTimeEdit1.SpinButtons.Display = Infragistics.WebUI.WebDataInput.ButtonDisplay.OnRight; this.WebDateTimeEdit1.Nullable = false; this.WebDateTimeEdit1.EditModeFormat = "g";
this.UltraWebGrid1.Columns[0].EditorControlID = this.WebDateTimeEdit1.UniqueID; this.UltraWebGrid1.Columns[0].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom; this.UltraWebGrid1.Columns[0].AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes; this.UltraWebGrid1.Columns[0].DataType = "System.DateTime"; } } }
When you click out of the cell, it loses the date and resets back to a really unknown date in 2010..
yeah i have done all that first time in displays values hh;mm. then when i click in the cell regardless of spin buttons or not, it changes to todays date. then when i click off and back into the cell, some unknow date is set...
so to recap: format hh:mm
i populate the column with todays date and time "18/02/2009 8:50AM..
so first display is hh:mm: 8:50
then click on cell and it displays the todays date dd mm yy with no time? 18-02-2009
then click off and back on the cell, then it displays some uknown date in backwards format "06-02-2010" <-- where the hell does this come from?
I am creating this grid dynamically but populating from a datatable with a date column.
I am also creating web date time editor in code by controls.add() add mapping it to the column by uniqueId
Maybe configuration of grid column is not correct. To use WebDateTimeEdit, the column should have settings for following properties: Type, EditorControlID and optional DataType (in case if column in DataTable.Columns was not created with that type). The column.Format should not be used, because format will be defined by WebDateTimeEditor.
//DataTable dt = new DataTable("Customer");//dt.Columns.Add("DateColumn", typeof(DateTime));//this.UltraWebGrid1.DataSource = dt;
this.UltraWebGrid1.Columns[0].EditorControlID = this.WebDateTimeEdit1.UniqueID;this.UltraWebGrid1.Columns[0].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;//this.UltraWebGrid1.Columns[0].DataType = "System.DateTime";