Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Webdatepicker date changed after the postback
posted

Hi,

I have created dynamic web date picker in my application.  i select the date (05/26/2017 12:00:00 AM )  , after the post back it get changed as ( 05/25/2017 06:30:00 PM).

Note : if i set the machine time zone Central time (US & CANADA) means it's working fine, after the post back date not changed in web date picker.

If I set other time zone means issue will come,

Review my code and kindly give the solution for this issue.

wdcDateColumn = new WebDatePicker();
wdcDateColumn.Width = Unit.Pixel(115);
wdcDateColumn.ID = columnName;
wdcDateColumn.BackColor = Color.White;
System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
ci.DateTimeFormat.LongDatePattern = datePreference;
ci.DateTimeFormat.ShortDatePattern = datePreference;
wdcDateColumn.Culture = ci;
wdcDateColumn.Nullable = true;
wdcDateColumn.ClientSideEvents.ValueChanged = "AssignModifiedDate";
container.Controls.Add(wdcDateColumn);
wdcDateColumn.NullText = String.Empty;

Parents
No Data
Reply
  • 7375
    Offline posted

    Hello Raja,

    In order to ensure that your issue is addressed correctly I will need some more information like: 

    1. May I know which version of infragistics you are using?
    2. Which exactly events your application uses to submit form?
    3. Which browser (version) you are using?

    I tried putting your code within page load and on post back the value in the WebdatePicker is displaying correctly.
    As a container I am using page.form like this :

    Page.Form.Controls.Add(wdcDateColumn);

    As you are generating control dynamically application should ensure that any dynamic Control does not appear outside of Form. Of in case of aspx, a control should be inside of <form>. Otherwise, that control will not function correctly on client and/or values modified on client will be not passed to server after a postback.

    I have created a sample application to test the behavior using version 16.2.20162.1023 with culture ‘en-US’ and ‘es-ES’ and did not able to reproduce the issue, please find the attached sample for your reference.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back for further investigation.

    Please note as US office is closed on Monday (05/29/2017) so I will be able to provide you my update on Tuesday(05/29/2017) .

    WebDatePicker.zip
Children