Force user to select date in jQuery Datepicker in ASP.Net

Last Reply 28 days ago By dharmendr

Posted 28 days ago

I have a textbox with a javascript datepicker.

I would like to force the user to select a date and prevent the user from typing in their own date.

 Below is my text box

<asp:TextBox placeholder="dd/mm/yyyy" ID="txtDate" AutoPostBack="false" runat="server" class="form-control" />

Datetime picker code.

<script type="text/javascript">
    $(document).ready(function () {
            dateFormat: 'dd/mm/yy'


Posted 28 days ago

Hi Tevin,

Set the ReadOnly property of the TextBox to True.

Refer below article.

Implement jQuery UI DatePicker (Calendar) with ReadOnly TextBox in ASP.Net