Unobtrusive Validation in ASP.Net 4.5 webforms

Enabling unobtrusive validation from scratch in ASP.Net 4.5 webforms

http://jupaol.blogspot.co.uk/2012/09/enabling-unobtrusive-validation-from.html

Advertisements

Missing asp.net designer files

While working in Visual Studio on an ASP.Net web application (that was converted from a web site project), and which has controls defined in markup in a .aspx or .ascx file, you may find that attempting to reference the controls from the code-behind file causes an error such as:

‘[Type]’ does not contain a definition for ‘[indentifier]’  and no extension method ‘[indentifier]‘ accepting a first argument of type ‘[Type]’ could be found (are you missing a using directive or an assembly reference?)

This issue results from the fact that controls created on a .aspx or .ascx page within a website project do not have a .designer file.

A potential fix is to right-click on an individual file and choose ‘Convert To Web Application’. This forces Visual Studio to create the designer partial class file. Once the .designer file is created, the controls added in the markup of the .aspx or.ascx file become visible and accessible in the code-behind file as well, with intelliSense.

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

You may run into this error when you attempt to reference and consume an Entity Data Model that has been created in a stand-alone project as a class library, from a new ‘client’ project such as a Windows Forms project, Windows Console App, or an ASP.Net project.

FIX:
The reason for the error is, after you add a reference in the consuming project to the Entity Data Model DLL, you mustn’t forget to either:

a) create your own .config file in the consuming project and add the connectionstring entry of the Entity Data Model,
or
b) copy the App.config file from the Entity Data Model project, into the consuming project (by right-clicking the Project > Add Existing Item > Navigating to the Entity Data Model project and selecting its App.config file).

Also worth checking to make sure that the model’s MetaData Artifact Processing property is set to ‘Embed in Ouput Assembly’ which effectively ensures all the required schema files are embedded into the compiled DLL as resources, and are also made a part of the connection string for the model. (In the Entity Data Model project, double-click to open the model and check it’s MetaData Artifact Processing property in the Properties window, by default this should already be set to ‘Embed in Output Assembly’).