Textbox Mode DateTimeLocal not working when deploy

2019-08-15 16:54发布

问题:

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Cannot create an object of type 'System.Web.UI.WebControls.TextBoxMode' from its string representation 'DateTimeLocal' for the 'TextMode' property.

Source Error:

I set my Textbox TextMode=DateTimeLocal and ran my project and it runs well. When I tried to deploy my application to IIS and visit the webpage i would get the error above. IIS has .Net 4.0.30319. Is there a reason why i get it on localhost (on my computer) and not the server (iss)? how do i fix this?

回答1:

There are only three members in the TextBoxMode Enumeration for ASP.NET 4.0:

  1. SingleLine: Represents single-line entry mode.
  2. MultiLine: Represents multiline entry mode.
  3. Password: Represents password entry mode.

There are a considerable amount more, including DateTimeLocal in TextBoxMode Enumeration for ASP.NET 4.5.

Your localhost is running ASP.NET 4.5, and apparently your server is not... ensure you have ASP.NET 4.5 installed on your server.

UPDATE: for people who can't upgrade to ASP.NET 4.5, you can likely just set the type="datetime-local" for the TextBox as an alternative.



回答2:

Install asp.net 4.5 on server and works!