Wednesday, April 11, 2012

Changing Settings in an Existing Project

The Project Wizard allows you to change settings that will be applied to the entire application.

Settings can affect one of two things in the application – data controllers or pages. An example of a setting that affects the data controllers is enabling standard action column in all grid views. An example of a page setting is changing the page layout.

If you change any setting in the Wizard, then it is necessary to use the Refresh project action to have the changes reflected in the generated application.

However, changes will only be reflected in the project if the following two conditions are met:

  1. The page, user controls, or controller elements have not been changed in the Designer.
  2. The application and data controller baseline files have not been edited by hand.

If these conditions are not met, then the settings will only be applied to new pages and controllers added to the application at a later time. The verification of these conditions is performed by the application generator to prevent overwriting of project customization.

Consider the Layout setting, which affects the application pages. By default, the layout property is set to Classic. This will create a master view at the top of each page, and all child views in tabs underneath the master view.

Create a brand new Northwind sample application. As you go through the project wizard, leave the layout with the default property of Classic.

Layout page in Code On Time Project Wizard

To change the layout, select the project name on the start page of the web app generator, and choose Settings.

Settings option of a Code On Time web application

Click on the Layouts option.

Layouts page under Settings in Code On Time web application generator

Let’s change the default layout to Tabbed. This puts all master and child views on different tabs in a single page container.

Tabbed standard page layout enabled 

Press Finish to go to the Summary page, and click on Refresh. The layout option change only affects the pages, so just press the Refresh button.

Refresh screen for Northwind sample in Code On Time web application generator

Press OK to confirm the refresh, and proceed to generate the application.

The web application will open in your default web browser. The new tabbed layout will be implemented on all pages in the application.

Customers page with Tabbed Layout in Code On Time web application

Now, let’s add an action column to a select few controllers.

Switch back to the web application generator, select the project name, and click Settings. Navigate to the Features page, and switch to the Grid Properties section. Toggle the checkbox Enable standard action column in all grid views.

Features page of Code On Time Project Wizard with Standard Action Column property enabled

Press Finish, and on the summary page click Refresh. Check the box next to Orders and OrderDetails controllers. Press Refresh button at the bottom of the screen, and then press Yes to confirm the action.

Refreshing data controllers in a Code On Time web application

Click Generate, and wait for the web application to load in your web browser.

You can see that the Customers grid view has not been changed, as it was not included in the refresh.

Customers grid view without Action Column in Code On Time web application

If you switch to the Orders tab, you will see the new action column at work. Actions Edit and Delete are rendered in the first column of the grid view.

Orders grid view with Actions Column in Code On Time web application

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com