Date format in RangeValidator

后端 未结 2 595
暗喜
暗喜 2021-01-05 11:09

I am using RangeValidator to validate date enter in textbox and its working fine with default date format but now i want the date format in \"dd/MM/yyy\" but its generating

相关标签:
2条回答
  • 2021-01-05 11:48

    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

    0 讨论(0)
  • 2021-01-05 11:56

    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");
    }
    
    0 讨论(0)
提交回复
热议问题