I made an asp.net 4.5 web form application. In my app, one webform
has a compare validatior
control. Here is my aspx
code:
Here's my aspx.cs code for that validator:
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
string currentDate = DateTime.Now.ToString("dd/MM/yyyy");
ComparevalidatorDOB.ValueToCompare = currentDate;
}
}
It works fine on my PC. But when I published the web form application
in smarterasp; I get this error whenever I go the page using compare validator:
How can I solve this error? Please note that I'm getting this error after publishing the application. The app works fine in my visual studio 2017. And I can't use javascript
for some particular reason.
Found a solution to my problem. Here it is... I added the appropriate culture for date on the top of the page where the problem was occurring.
Now my page works fine.
P.S: I found this link very useful to determine which culture to use for different types of format.