HI,
if I use this code in Page_Load event, webDatePicker shows the right Date:
--------
DateTime BaseYear = new DateTime(DateTime.Now.Year,1,2);
FormWebDatePicker = (Infragistics.Web.UI.EditorControls.WebDatePicker)FormView1.FindControl("WebDatePicker1");
FormWebDatePicker.Value = BaseYear.ToShortDateString();
FormWebDatePicker.Text = BaseYear.ToShortDateString();
if i use this code in the RowSelectionChanged-Event of a WDG, WebDatPicker is always empty:
int j = Convert.ToInt32(e.CurrentSelectedRows[0].Items[4].Text); // j = 66
DateTime BaseYear = new DateTime(DateTime.Now.Year,1,2).AddDays(j); //BaseYear.ToShortDateString() = "07.03.2012"
Why that happend and how to solve this?
Hello Kociemba,
Thank you for posting in the community.
In this scenario it is likely that WebDataGrid has itsEnableAjaxproperty set to true (default), therefore the postbacks on rowselectionchanged are asynchronous and the WebDatePicker is not refreshed. I suggest that you disable WebDataGrid's Ajax. Optionally you may place both WDG and the WebDatePicker in an UpdatePanel to make use of AJAX in this scenario.
Please let me know if this helps.
Please do not hesitate to contact me if you have any further questions regarding this matter.