Date format in RangeValidator

独自空忆成欢 提交于 2019-11-30 21:23:44

MinimumValue & MaximumValue need to be set in the Page_PreRender event and appear to require the date format as "dd-MM-yy"...see last post on Rangevalidator Min Max Value error

protected void Page_PreRender(object sender, EventArgs e)
{
    RangeValidator1.MinimumValue = DateTime.Now.Date.ToString("dd-MM-yy");
    RangeValidator1.MaximumValue = DateTime.Now.Date.AddYears(90).ToString("dd-MM-yy");
}

Format of the MinimumValue and MaximumValue should be yyyy/MM/dd

Check documentation here: https://msdn.microsoft.com/en-us/library/ydez7ad7(v=vs.110).aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!