Monday, June 18, 2012

Working with Controls

Controls are instances of user controls that are placed in containers.

The picture below shows the default Home page with controls TableOfContents and Welcome placed in two containers.

Two controls in different containers on the Home page.

Creating a Control

Controls can be added to a container by using the New Control option in the container context menu.

New Control option on the container context menu.

The New Control icon on the toolbar can also be used.

New Control icon on the Project Explorer toolbar.

This will open the New Control form in the Project Designer window. The Id of the control will be automatically assigned, and can be changed in the Project Explorer.

Moving Controls

Dropping a control onto another control will place it after the target control.

Dropping control1 on control4.     Control1 is placed after control4.

The context menu actions Cut and Paste will also serve the same purpose.

Cut context menu option on control3.     Paste context menu option on control1.

Dropping a control to the right side of another control will place it after the target control.

Dropping control4 on the right side of control3.     Control4 placed after control3.

Dropping a control to the left side of another control will place it before the target control.

Control2 dropped on the left side of control3.     Control2 placed before control3.

Holding CTRL key while dropping on a page or container will duplicate the control. If a control with the same Id already exists in the page, the new control will be renamed.

Control4 copied into container2.     Control5, a copy of control4, placed in container2.

Dropping a control onto a container will place the control at the bottom of the container.

Control1 moved into container4.     Control1 is placed at the end of container2.

Dropping a control onto a page will move that control onto that page in a new container.

Control2 dropped on Home page.     Control2 placed in a new container 'c101' in the Home page.

Renaming a Control

Controls can be renamed using the Rename context menu option.

Rename option on control3 context menu. 

The keyboard shortcut F2 will also activate Rename command.

Control3 in Rename mode.

Editing Controls

A user control can be edited by using the context menu option Edit in Visual Studio. This option will only be present if the user control property Generate is set to “First Time Only”.

Context menu option Edit in Visual Studio for a control in Project Explorer.

Deleting Controls

Controls can be deleted using the Delete context menu option.

Delete option on control3 context menu.

The Delete key will activate Delete action.

Multiple controls deleted at once by pressing Delete on the keyboard.

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