Please enable JavaScript to view this site.

Navigation: Using ASPRunner.NET > Page Designer

Insert code snippet

Scroll Prev Next More

 

You can add C#/VB.NET code snippets to modify the appearance and functionality of the generated web pages. For example, you can add additional control elements to a web page or display some information.

 

To add a C#/VB.NET code snippet, follow the instructions below.

 

1.Proceed to the Page Designer and select a page you wish to modify.

 

2.Click Insert - Code snippet on the main toolbar.

toolbar_snippet

 

3.Add the C#/VB.NET code into the opened window and click OK.

 

4.The new page element labeled <Table name>_snippet appears on the page. If your code snippet displays some data on a web page, move the "snippet" element to where you wish to see that data.

visual_editor_snippet_element

 

Use the Edit snippet code button to edit a code snippet. You can edit a code snippet on the Events page as well. To delete a code snippet, click the Remove button.

snippet_element_edit

Examples

1. Display the current time:

 

MVCFunctions.Echo(MVCFunctions.now());

 

2. This is how you can get access to the fields of the current record from the code snippet added to the Edit/View page. For example, you can print the value of the field "Make".

 

First, implement Process Record Values event of View or Edit page and save record data in the session variable.

 

 

XSession.Session["currentRecord"] = values;

 
Second, print this field value from the code snippet:

 

 

 

MVCFunctions.Echo(XSession.Session["currentRecord"]["Make"]);

 

 

3. Add a dropdown list box with specific values.

 

4. Show a list of customer orders.

 

5. Show data from a master table on the details view/edit/add page.

Page Designer articles:

About Page Designer

Working with common pages

Working with table pages

Working with cells

Working with page elements

Working with additional pages

Page layout and grid type

Tabs and sections

Insert custom button

Insert map

Insert Text / Image

Insert standard button

"View as" settings

"Edit as" settings

"Filter as" settings

See also:

Choose pages screen

Choose fields screen

Miscellaneous settings

Editor screen

Event editor