I am trying enable only current date but disable future dates. Please help me.
Ny code:
txtshiftdate.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd");
ASPX Code:
<asp:TextBox type="date" TabIndex="3" CssClass="form-control" runat="server" ID="txtshiftdate" />
If you want to check if a date that is entered in the textbox is within a certain range, you should write the validation code in the OnTextChanged handler for example:
<asp:TextBox ... OnTextChanged="txtshiftdate_TextChanged">
In the handler, you should parse the input and change it for to the corrected value if necessary.
protected void txtshifdate_TextChanged(object sender, System.EventArgs e)
{
txtshiftdate.Text = DateTime.Now.ToString("yyyy-MM-dd");
}