question

Jackson1990-7147 avatar image
0 Votes"
Jackson1990-7147 asked YijingSun-MSFT answered

Example needed

Hi,
Further to details below, is there one example to prompt the Calendar due to one click to a date field?

<asp:Calendar ID="Calendar1" runat="server" SelectedDate="<%# DateTime.Today %>" />


dotnet-aspnet-generaldotnet-aspnet-core-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YijingSun-MSFT avatar image
0 Votes"
YijingSun-MSFT answered

Hi @Jackson1990-7147 ,


Could you tell us your date filed? Assume you have a textbox as the date field, you could try to use jquery datepicker to prompt the calendar.Just like this:

131856-image.png
Note: You must add jquery-ui jquery package.




If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.


Best regards,
Yijing Sun


image.png (29.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Jackson1990-7147 avatar image
0 Votes"
Jackson1990-7147 answered YijingSun-MSFT edited

I put the code and cannot show the picker. What to adjust below?
131828-3g.png



3g.png (23.1 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Jackson1990-7147 ,

Wheather you have the input 's id is "datepicker"? You could F12 to check if your codes have error when you running the project. And the script,you only need to write this <script>$(function(){$("datepicker").datepicker()})</script>. I'm guessing that you have error with datepicker's js function.


0 Votes 0 ·
Jackson1990-7147 avatar image
0 Votes"
Jackson1990-7147 answered

Can you advise if field (in red) below should not be name of Textbox?
133418-4g.png



4g.png (6.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YijingSun-MSFT avatar image
0 Votes"
YijingSun-MSFT answered

Hi @Jackson1990-7147 ,
That was not what I meant. I tried your codes and debug it for pressing F12. And then I get the error message of "Uncaught TypeError: $(...).datepicker is not a function(anonymous function)". I'm guessing that you have the same error message. The reason is the jquery file and jquery-ui file wrong. You need higher version of the jquery file and jquery-ui file.Just like this:
134196-capture11.png
Best regards,
Yijing Sun


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.



capture11.png (23.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.