Asked by:
What is the best way to use custom pages?

Question
-
User-1735691636 posted
We have a database with 20 tables. All of the pages need some kind of adjustment.
Do I really need to create a folder with the table name and copy the default page templates (list.aspx, edit.aspx, insert.aspx) in there? (so i get 60 pages (3 templates * 20 folders).
Grz,
Marco
Monday, December 8, 2008 10:46 AM
All replies
-
User-1005219520 posted
Custom pages have the most flexibility because you know the schema of the particular entity - but there are plenty of ways to to modify the display without a custom page. You can apply the custom field template to any field in the DB using annotations in the entity partial class. How to: Customize Data Field Appearance and Behavior For Non-Intrinsic Data Types in the Data Model shows how to do this. See also How to: Customize Data Field Display in the Data Model
Depending on what you want to modify, you can use UIHint http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.dynamiccontrol.uihint.aspx and http://weblogs.asp.net/craigshoemaker/archive/2008/05/08/passing-arguments-to-a-dynamic-data-field-template-from-a-uihint-attribute.aspxMonday, December 8, 2008 2:04 PM -
User1641955678 posted
Could you give examples of some of the tweaks that you need to do?
thanks,
DavidMonday, December 8, 2008 3:05 PM -
User-1735691636 posted
There are pages where I don't need to show all colums or add functionality like search options.
Do I need to copy the list.aspx (and other template files) from the template folder and add this to a new created folder (tablename) in the solution (and repeat this for all different default lists)?
I hope you understand what I mean.
Grz,
Wilco
Tuesday, December 9, 2008 3:41 AM -
User1641955678 posted
You can use the ScaffoldColumn attribute on the model to choose what columns to show. Generally, you can do a lot of things without creating custom pages with a combination of:
-
Model attributes
-
Custom column generator
-
Customizing the shared page templates (under DynamicData\PageTemplates)
Of course, if you want to do really unique things for certain tables, then a custom page is the way to go.
David
Tuesday, December 9, 2008 2:29 PM -