Saltar apartados

Template data

Seeing the options that allows the validation, have reviewed that UIHint allows us define the staff of visualisation of the element.

Definimos en el modelo la plantilla del campo

We go to create a staff in Views/Shared/DisplayTemplates and Views/Shared/EditorTemplates. In the first will define the staff for when we call to the method Display in the sight, and the second when we call to the method Editor.

Can that these last folders even do not exist, with what before have to create them with the right button Add->New Folder.

We created a new sight in DisplayTemplates (only go to see the visual result)

Crear plantilla para el campo del modelo

We indicate the name, for example Dates, and marked it like Partial View (.ascx)

Marcar la vista como parcial

It generates us a cabecera and added him some format, in our case put it in bold and in itálica

Código plantilla del campo del modelo

If in the staff of detail modify what have generated by defect by

LLamada a la plantilla desde la vista

The result will be

Resultado visual de la representación de la plantilla

Computing service ASP.NET MVC 2 Framework


Universidad de Alicante
Carretera de San Vicente del Raspeig s/n
03690 San Vicente del Raspeig
Alicante (Spain)

Tel: (+34) 96 590 3400

Fax: (+34) 96 590 3464

For further information: informacio@ua.es, and for enquiries on this web server: webmaster@ua.es

Carretera San Vicente del Raspeig s/n - 03690 San Vicente del Raspeig - Alicante - Tel. 96 590 3400 - Fax 96 590 3464