Base solution for your next web application
Open Closed

datetimepicker "selectedDate" not working during edit mode. #6369


User avatar
0
kumaran created

Hi

My problem is similar to this support issue https://support.aspnetzero.com/QA/Questions/4328
The links inside the above support case does not work.

The issue i am having is in a modal dialog.

Here is my UI for the datetime picketr

<input class="form-control" type="datetime" [(selectedDate)]="showVar.showDate" #Show_ShowDate id="Show_ShowDate" name="Show_ShowDate" required>

In the edit mode the datetime picker control is empty instead of showing the model value.

Any reason why?

Thanks


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kumaran

    • Are you using latest version of AspNet Zero ?
    • Is your page generated with RAD Tool ? If so, what is your RAD Tool version ?

    Thanks,

  • User Avatar
    0
    kumaran created

    Hi

    I am using v5.5.0.0 and i am showing these dates in a modal window. This was not created by rad tool.

    By the way i was able to fix it by doing the following.

    Point me to the right direction to upgrade the code to the latest version because the code has been customized a lot in the project. Don't want to mess the existing code.

    Thanks.

    1. In the html i had the following .. <input class="form-control" type="datetime" #Show_ShowDate id="Show_ShowDate" name="Show_ShowDate" required>

    2. In the typescript i had

    ngAfterViewInit(): void { ..

        // default date picker
        $(this.Show_ShowDate.nativeElement).datetimepicker({
            locale: abp.localization.currentLanguage.name,
            format: 'L LT'
        });
    

    }

    1. When i show the modal window, to load the data from the db, ..

              let startDateTime: Element = document.getElementById("Show_ShowDate");
      
              if (startDateTime) {
                  (startDateTime as HTMLInputElement).defaultValue = moment(this.showVar.showDate).format('L LT');
              }