Professional Documents
Culture Documents
Manual Asprunnernet
Manual Asprunnernet
Manual Asprunnernet
Net manual
2009 Xlinesoft
ASPRunner.Net manual
Table of Contents
Part I Introduction
1 Welcome
................................................................................................................................... 1
2 System requirements ................................................................................................................................... 1 3 Licensing details ................................................................................................................................... 2 4 What is the registration ................................................................................................................................... 3
1 Working with ................................................................................................................................... 4 projects 2 Connecting to the database ................................................................................................................................... 5 3 Datasource tables ................................................................................................................................... 9 4 Master-detail ................................................................................................................................... 12 5 Choose pages ................................................................................................................................... 15 6 Login page ................................................................................................................................... 18 7 User login settings ................................................................................................................................... 19 8 Avanced Security Settings ................................................................................................................................... 23 9 User group permissions ................................................................................................................................... 25 10 Fields order ................................................................................................................................... 26 and totals 11 Miscellaneous settings ................................................................................................................................... 28 12 Choose theme ................................................................................................................................... 29 13 Visual Editor................................................................................................................................... 30
About .......................................................................................................................................................... 30 Toolbars .......................................................................................................................................................... 31 Page Elements .......................................................................................................................................................... 34 "View as" settings .......................................................................................................................................................... 35 "Edit as" settings .......................................................................................................................................................... 41 Validation types .......................................................................................................................................................... 48 Lookup wizard .......................................................................................................................................................... 50
14 Events
................................................................................................................................... 56
15 Output directory settings ................................................................................................................................... 57 16 After you done ................................................................................................................................... 59 17 FTP upload ................................................................................................................................... 61 18 FrontPage Publishing ................................................................................................................................... 62
64
Contents
II
6 Events
................................................................................................................................... 90
More about events .......................................................................................................................................................... 90 Predefined actions .......................................................................................................................................................... 91 Send simple email ......................................................................................................................................................... 91 Send email with new data ......................................................................................................................................................... 95 Save new......................................................................................................................................................... 98 data in another table Insert a record into another table ......................................................................................................................................................... 102 Check if ......................................................................................................................................................... 106 specific record exist Display a message on the WEB page ......................................................................................................................................................... 110 Redirect......................................................................................................................................................... 114 to another page Custom ......................................................................................................................................................... 117 code Sample code .......................................................................................................................................................... 120 Show list of customer orders ......................................................................................................................................................... 120 Before deleting a record check if related record exist ......................................................................................................................................................... 121 Check if ......................................................................................................................................................... 122 start date is earlier then end date Speed up data entry using events ......................................................................................................................................................... 122
123
2009 Xlinesoft
II
ASPRunner.Net manual
1
1.1
Introduction
Welcome
1.2
System requirements
ASPRunner.NET is designed for Windows operating systems including Windows 2003, Windows XP, Windows 2000. Windows Me, Windows 98, Windows 3.1 systems are not supported. To run with ASPRunner.NET, your system should be equipped with the following: Microsoft .NET Framework Version 2.0 Redistributable Package The .NET Framework version 2.0 redistributable package includes everything you need
2009 Xlinesoft
Introduction
to run applications developed using the .NET Framework Microsoft ADO Version 2.8 or higher (for connection to ODBC Data Source). This is already the case for users running Windows 2000/XP or have MS Access 2000/XP installed 486 processor (minimum) or faster (recommended) 32 MB RAM (minimum) or more (64 MB or more recommended) Windows operating system such as Microsoft Windows 2003, XP, 2000 15 MB free disk space (minimum) or more Microsoft Access Data Objects comes with support of MS SQL, Oracle, MS Access, Excel, MS FoxPro databases. If you use another database ( e.g. MySQL or DB2 ), you have to install appropriate ODBC driver for your database. See ODBC help topic for details. Microsoft IIS 6.0 or higher. Internet Information Server (IIS) is required to test generated ASP.NET pages locally. Optional: Visual Studio .NET 2005/2008 or Visual Web Developer ASPRunner.NET also requires a few other system files. To update your system, go the Microsoft download pages listed below. If you are not yet using IE 6.0, it is recommended to install it as it includes most if not all of the required files.
Databases Supported ASPRunner.NET can connect to virtually any ODBC compliant database using the appropriate drivers installed on the computer where ASPRunner.NET is present. Supported databases include: Microsoft SQL Microsoft Access Oracle MySQL All other databases with an appropriate ODBC driver The generated code does not require ODBC connectivity.
1.3
Licensing details
1. License
By receiving and/or using ASPRunner.NET, you accept the following Evaluation and Registered User Agreement. This agreement is a binding legal agreement between XLineSoft and the purchasers, users or evaluators of XlineSoft's software and products. If you do not intend to honor this agreement, remove all installed XLineSoft products from your computer now.
2009 Xlinesoft
ASPRunner.Net manual
must register the program with XLineSoft or remove the software from your computer. You may allow other users to evaluate copies of the unregistered software. All evaluation users are subject to the terms of this agreement. The evaluator/user/buyer/owner is not allowed to attempt to reverse engineer, disassemble or decompile any XLineSoft products. XLineSoft name and any logo or graphics file that represent our software may not be used in any way to promote products developed with our software. All parts of XLineSoft products are copyright protected. No program, code, part, image, video clip, audio sample, text or computer generated sequence of images may be copied or used in any way by the user except as intended within the bounds of the single user program. The evaluator/user/buyer/owner of XLineSoft will indemnify, hold harmless, and defend XLineSoft against lawsuits, claims, costs associated with defense or accusations that result from the use of XLineSoft products. XLineSoft is not responsible for any damages whatsoever, including loss of information, interruption of business, personal injury and/or any damage or consequential damage without limitation, incurred before, during or after the use of our products. Our entire liability, without exception, is limited to the customers' reimbursement of the purchase price of the software (maximum being the suggested retail price as listed by XLineSoft) in exchange for the return of the product, all copies, registration papers and manuals, and all materials that constitute a transfer of ownership from the customer back to XLineSoft. Each registered copy of the ASPRunner.NET may be used in only one single location by one user. Use of the software means that you have loaded the program and run it or have installed the program onto a computer. If you install the software onto a multi-user platform or network, each and every individual user of the software must be registered separately. You may make one copy of the registered software for backup purposes, providing you only have one copy installed on one computer being used by one person. If any person other than yourself uses XLineSoft software registered in your name, regardless of whether it is at the same time or different times, then this agreement is being violated! The sale of and or distribution of registered copies of this software is strictly forbidden. It is a violation of this agreement to loan, rent, lease, borrow, or transfer the use of registered copies of XLineSoft products.
1.4
ASPRunner.NET is "Try before you buy" software. This means that we have made the software available to you for free evaluation. You are entitled to evaluate the software for up to 21 days without obligation to pay. After 21 days, if you decide to keep the software, you must register your copy with us. Demo version (non-registered) of ASPRunner.NET is a "full-featured" release. This means that the same capabilities available in the registered software are present in the non-
2009 Xlinesoft
Introduction
registered software. This allows you to try out all the features in ASPRunner.NET to confirm that they work to your satisfaction. Registration entitles you free technical support for 30 days and free minor upgrades to the software. Registration may also entitle you to discounts on new software releases from XLineSoft. We will also send you information bulletins by email to let you know about whats happening with other XLineSoft products. Finally, by registering the software, you provide us with the resources and incentive to support the software with updates and to develop additional quality software products in the future. How can I register?
2
2.1
Using ASPRunner.NET
Working with projects
Project structure With ASPRunner.NET, you can save all your settings in a single project file and do not have to go through individual files if you simply need to change a single label or field format. For each project ASPRunner.NET saves to its own directory with the following subdirectories: 1. visual - Contains modified visual templates. 2. tmp - Temporary storage of visual templates. 3. output - Directory with output files. You can change or rename the Output directory. The default directory for a new project is projects/project_name. The Project file will be saved in the project directory as project_name.netr. When you open a project created with a previous version of ASPRunner.NET, you are prompted to choose a project directory. After you select a directory, your project file is copied to it. Then the next time you open your project it will be from the folder you selected, not from the original location. If you upload files to the Web server using third party FTP client software, you must upload the entire contents of the output directory. When you make a backup of your project, you should include all files in the project directory together with all subdirectories. At a minimum, you should backup the project file itself along with all files in the visual directory. Click the "Project" button and select from the drop down list to open an existing project or to save the current one. Opening an existing project
2009 Xlinesoft
ASPRunner.Net manual
To open existing project or save a current one, click Project button any time.
Saving a project If you want to save the current project under a different name - for example, development purposes or to create a backup - select the "Save Project As" option. A new project directory will be created and all necessary project files will be copied to it. Note: ASPRunner.NET creates a new project automatically upon startup.
2.2
ASPRunner.NET supports the following databases: MySQL Oracle Microsoft SQL Server MS Access
2009 Xlinesoft
Using ASPRunner.NET
Select your database type and press Next>>. Depending on the selected database type you will see one of the database-specific dialog boxes shown below.
Connecting to MySQL - type the Host/Server Name (usually localhost), user name, password and click Connect.
2009 Xlinesoft
ASPRunner.Net manual
Connecting to Oracle, Microsoft SQL Server - type the Database Name, username, password and click Connect. Connecting to MS Access (ODBC Data Source) - browse for database file. Press Open when done.
2009 Xlinesoft
Using ASPRunner.NET
Check Create a databse copy in App_Data folder if you want relative path to be used in database connection string. Please also specify the path name if the database is located at a subfolder from the root. Use this option if you plan to transfer files to the remote Web server. In this case ASPRunner.NET creates a copy of database in the Output folder. ASP. NET pages will work with this database file copy which means you won't see changes in original database file.
2009 Xlinesoft
ASPRunner.Net manual
Press Next>> when done. Click the Recent database button to see a list of recently opened databases. You can use this button to quickly connect to previously opened databases. After you successfully connected to database, it is time to select datasource tables.
2.3
Datasource tables
2009 Xlinesoft
Using ASPRunner.NET
10
more about SubSonic at http://www.subsonicproject.com. DAL limitations: Every database table needs to have one primary key. Compound primary keys not supported.
To switch between selected tables use Table list button on the left.
If you'd like to keep default settings for the rest of tables jump to Output directory tab and build ASP.NET code. Using Add new table window you can add a new table to existing database.
2009 Xlinesoft
11
ASPRunner.Net manual
For each field type name, type, size, scale (applies to DECIMAL datatype in SQL Server, Oracle and MySQL only). Set the Primary key field. Databases created with ASPRunner.NET will be saved into C:\Program Files\ASPRunner.NET\database.mdb (database1.mdb, database2.mdb etc.) NOTE: Don't change table settings after you've built the project and added data records. All data will be lost after table modification. To edit or delete tables right click on the table name in the list.
2009 Xlinesoft
Using ASPRunner.NET
12
View Closed listings displays closed listings only. SQL Query: Select * from Cars where status='closed' SQL query can be modified later on SQL query tab in ASPRunner.NET.
2.4
Master-detail
2009 Xlinesoft
13
ASPRunner.Net manual
2009 Xlinesoft
Using ASPRunner.NET
14
1. To create master-detail relationship in ASPRunner check off both master and detail tables in the list of datasource tables. 2. Drag and drop master key to detail key. 3. Double click on the relationship line. 4. Choose Master key(s) 5. Choose Details table Foreign key(s) (fields that matches Master key(s) in the Master table) 6. If you'd like to display Master record info on the Details page check off corresponding checkbox. Master page settings: 1. Preview detail records in popup
2009 Xlinesoft
15
ASPRunner.Net manual
2.5
Choose pages
Choose pages
To create View page, Edit page, Export page, Printer-friendly page, Add new, Copy and Delete record pages check off corresponding checkboxes. Inline add/Inline edit functions allow you to add/edit multiple records without leaving
2009 Xlinesoft
Using ASPRunner.NET
16
the List page. Inline Add/Edit functions use the same Edit as types as the regular Add/Edit pages.
In order to update and delete records in the database you have to select key field. You can see selected key columns on the right. To change key columns click Edit button. Note: Key column is the database column which lets you query each table row individually and modify each row without altering other rows in the same table. The values that compose a key column a unique; no two values are the same. In MS Access the best choice for key column is autonumber field.
2009 Xlinesoft
17
ASPRunner.Net manual
Choose fields
On this page you can choose fields to appear on each page. Check off or uncheck corresponding checkboxes.
2009 Xlinesoft
Using ASPRunner.NET
18
2.6
Login page
You can choose between two following options: Hardcoded username and password - all your users will use the same login/password combination. Username and password from database - choose this method if you store username/ password combinations in your database. In this case you need to choose database table with passwords and fields that store usernames and passwords. ASPRunner.NET will generate additional ASPX page named login.aspx which contains username/password validation. If second option is selected, you can also set Avanced Security Settings. Click User login settings button to create user self-register page, password reminder, change password pages.
2009 Xlinesoft
19
ASPRunner.Net manual
2.7
Click User login settings button to create user self-register page, password reminder, change password pages, encrypt passwords using MD5 algorithm.
In the Email settings you can enter SMTP settings and email which will be used to send emails to users. By clicking Choose fields... button, you can select fields that will appear on the registration page. Do not forget to choose field where user email is stored if you are going to use Send email to user option or Remind password page.
2009 Xlinesoft
Using ASPRunner.NET
20
Bold fields are required. Send activation link - email with activation link will be sent after the registration. The purpose of the activation link is to ensure that the user signs up with a real, active email address that they own. This limits the number of times someone can sign up, and prevents people who have been booted off a site from signing up again multiple times with fake email addresses. User access is denied until activation link is open in the browser. You can select one of your fields or create new one where activation flag will be stored. This field needs to be numeric (Number, INT or TINYINT).
Captcha protection - CAPTCHA is a simple test to determine if a user is a computer or a human. It is used to prevent spam abuse on the websites. So if you use CAPTCHA in your application, this can help in stopping some bots and making life harder for other bots in accessing or using your project. Registration page:
2009 Xlinesoft
21
ASPRunner.Net manual
Restrict weak password - this option allows to restrict using simple passwords. You can select minimum password length, number of unique characters, digits or symbols.
Encrypt passwords - passwords are encrypted using MD5 algorithm. If you choose to encrypt password Password reminder page will reset your password and send it to user Password reminder page:
2009 Xlinesoft
Using ASPRunner.NET
22
2009 Xlinesoft
23
ASPRunner.Net manual
2.8
1. Users can see and edit other users data Every user who logged in successfully can view, edit, and delete other users data. 2. Users can see and edit their own data only This option allows to restrict users to view and edit their own records only. To use this option you need to set a relationship between table that holds usernames and passwords and main data table. 3. Users can see other users data, can edit their own data only This option is similar to Option 2 however, all users can view other users data but cannot edit or delete them.
2009 Xlinesoft
Using ASPRunner.NET
24
Admin User When Option 2 or Option 3 is selected, you can also define Admin user who can access, edit, and delete all records in the database. To set Admin User, you need choose one of available UserIDs. Guest login This option adds guest read only access to the database. If this option selected, "Login as guest" link will be added to the login screen. Guest user cannot edit, delete or add new records to the database.
Define user group permissions Click Define user group permissions button to use group-based permissions model.
2009 Xlinesoft
25
ASPRunner.Net manual
2.9
This feature allows to assign table level permissions on database tables and views. I.e. user A can add data into table1 and edit data in table2, user B can edit and search data in table1 and can delete data in table2 etc. To use this feature proceed to Security step in ASPRunner.NET, click on "Define user group permissions".
On this screen, you can create user groups with assigned set of permissions. To add a new group, click "Add group". A dialog box will appear where you can choose username which defines this group and define initial set of permissions. Afterwards, you can change permissions for certain tables. Apart from this, you can create a default group with a default set of permissions. When a user not belonging to any of specified groups is logged in, the default set of permissions mentioned above is assigned to him. For example, as shown on the screenshot above, the user not belonging to any of the groups, is able to edit and delete data, but is not able to add or search records in any table. Also you can create a user group based on non-exising GroupID field value (if you plan to add users to this group later). To delete selected group, click "Delete group." To overwrite existing group, click "Add group" and choose the same username. With this security model you can also use Guest account with readonly access and Admin
2009 Xlinesoft
Using ASPRunner.NET
26
user with full permissions on all tables. You can add more permissions to the Guest account however this is not recommended.
2.10
This page allows to set fields order on each page. To change fields order on specific page, make this field or several fields selected and click on Up/Down buttons to move it up or down. Also you can use Drag & Drop to move fields.
- to apply changes to all tables click this button. Menu tab - Allows to change the order of tables on the menu.asp page. This tab is available when more than one table had been chosen for this project. On the &ldots;_list. aspx page Quick jump box will appear which contains list of tables for quick jump between tables.
2009 Xlinesoft
27
ASPRunner.Net manual
Also you can add totals calculation to some fields on the list/printer-friendly pages. You can choose between TOTAL, AVERAGE, and COUNT aggregate functions. To do it, select the field/fields you want to add totals calculation to and choose function type from drop-down box.
2009 Xlinesoft
Using ASPRunner.NET
28
2.11
Miscellaneous settings
Language Use the Language drop-down box to choose the Project language. By clicking Multiple language button you can select several Project languages and give the user ability to choose language while logging in.
2009 Xlinesoft
29
ASPRunner.Net manual
Regional settings Choose required country from drop-down box. Label Editor Label Editor allows you to edit table and field labels. You can translate labels into several languages if multilanguage support turned on in your project.
Table specific settings Miscellaneous settings that can vary from table to table. Use drop-down box with table names to switch between tables. In the Menu - you can create menu item for this table and rename table in Caption box. Truncate large text fields ... This option adds "More ..." link to long text field while first XXX characters displayed on the page. "More ..." link displays a popup with the whole field content.* *It is undesirable to use this option together with Rich Text Editor
Also you can enter number of records to appear on each list page.
2.12
Choose theme
On this page a user can choose theme for displaying pages. Theme is the combination of layout and color scheme.
2009 Xlinesoft
Using ASPRunner.NET
30
The Choose theme page consists of 3 sections/zones. Left part: Tables list - files tree. Moving across files, you can view how the selected page will look like. Middle part - themes selection. The user can choose themes either from the predefined list or in the advanced mode - choose layout and colors scheme separately. To switch between styles, click Show advanced mode button.
Note: The theme you've chosen will be applied to all pages of the project.
2.13
Visual Editor
2.13.1 About
Visual Editor built-in in ASPRunner.NET is an editor control that allows the user to edit HTML contents in a more user friendly way. The editor control is very flexible and enables the user to change the appearance of the pages in design or html mode.
2009 Xlinesoft
31
ASPRunner.Net manual
Features: Allows to see what the end result will look like while the pages are being created. Simply drag and drop objects onto the page and position them freely in the layout. No html coding is required and you do not need any web experience. Advanced users can make any changes and then go into the HTML mode and clean up the HTML code. Visual Editor Topics: Toolbars Page Elements Formatting Options Validation Types Lookup Wizard
2.13.2 Toolbars
Toolbars are the heart of the Visual Editor and provide a plenty of possibilities. The tables below describe the tools that can be found on the Main and Left toolbars along with its use
2009 Xlinesoft
Using ASPRunner.NET
32
Main Toolbar
Button Tool Name Reset Description Cancel all changes on the page and return all elements to the initial position. Visual HTML Editor Edit as HTML code Undo the last action Redo the last action Insert ASP code snippet Insert a database field Change the color of the text Allows to insert a new table or edit properties of the existing tables. Show or hide table borders Insert an image
Design Mode HTML Mode Undo Redo Insert ASP code snippet Insert Field Font Color Table Properties
2009 Xlinesoft
33
ASPRunner.Net manual
Hyperlink Edit
Insert a hyperlink Allows to cut, copy and paste text, undo changes or insert custom HTML code Insert a numbered list Insert a bulleted list Accomplish right shift Accomplish left shift
Left Toolbar
Button Tool Name Insert Table Description When you press this button new window appears in which you should specify number of rows and columns and table attributes. After that new table will be inserted in the specified place. Before using this button you have to set cursor into a table cell. New row will be inserted before the row where specified cell is located. Before using this button you have to set cursor into a table cell. New row will be inserted after the row where specified cell is located. Before using this button you have to set cursor into a table cell. New column will be inserted before the column where specified cell is located. Before using this button you have to set cursor into a table cell. New column will be inserted after the column where specified cell is located. Delete specified row
Delete Rows
2009 Xlinesoft
Using ASPRunner.NET
34
Delete specified column Merge two cells into one. The contents of the right cell is added to contents of the left one. Merge two cells into one. The contents of the lower cell is added to contents of the upper one. This button splits the cell into two parts. Open new window with table properties Open new window with cell properties
Merge Down
1. Header. The special element on which place the custom code may be inserted (the header of your pages). For that you should create header.asp file and put it into the Include folder. By default there is no header. 2. Master table info. The special element on which place information about the master table may be inserted. For that user should set the corresponding settings on the
2009 Xlinesoft
35
ASPRunner.Net manual Datasource Tables tab. 3. Custom Event. The special element on which place custom code that user added on the Events tab may be inserted. 4. Pagination. The special element that provides for the numbering of pages. It gives users the ability to step through a large number of database rows in manageable chunks instead of the whole lot in one go. 5. Footer. The special element on which place the custom code may be inserted (the footer of your pages). For that you should create footer.asp file and put it into the Include folder. By default there is no footer. 6. Fields. Each field selected on the Choose Fields tab will be presented on the page by corresponding element and user is able to control its appearance with the help of " View as" or "Edit as" settings.
Sometimes users need to go back to previous steps to make new changes after they have changed the initial view of the page. In this case after repeating return to the Visual Editor screen an alert window will appear with the suggestion to reset the page.
You can customize your data appearance on the list/view/print pages using formatting options on the "View as" settings dialog. To control the field appearance on the page click right button over the field and choose Properties. Depending on selected format you will see different box-dialogs.
2009 Xlinesoft
Using ASPRunner.NET
36
2009 Xlinesoft
37
ASPRunner.Net manual
File (available for Text and Binary fields) Depending on field type (text or binary field) you will be able to choose either URL prefix to folder where files are located or field name that stores filenames.
Here are some examples of URL prefix usage: images/ - images folder is located in output directory /images/ - images folder is located under website root ../images/ - images folder is located one level above http://www.abc.com/images/ - full path to images folder Note: in most cases URL prefix ends with forward slash.
2009 Xlinesoft
Using ASPRunner.NET
38
Mercedes-Benz-CL-500.jpg will be automatically converted into <img src="images/ Mercedes-Benz-CL-500.jpg" border=0> In case of Binary field you need to choose a field that stores filename. This filename is required to set correct file type when you retrieve uploaded file from the database. If you don't choose filename field or leave it empty you will be presented with Open with ... dialog every time you download this file from the database. Image (available for Text and Binary fields) Binary field - if you store images in the database, ASPRunner.NET creates a code that extracts images from database on the fly. Supported image formats are JPEG, GIF and BMP. If you want to display the thumbnail then you should select the appropriate checkbox and choose the field name that holds the thumbnail.
2009 Xlinesoft
39
ASPRunner.Net manual
Text field - choose image size and URL prefix similar to View as type File. If you want to display the thumbnail then you should select the appropriate checkbox and choose the thumbnail prefix. For example, if the original image file's name is example.gif and thumbnail file's name is th_example.gif correspondingly then the thumbnail prefix should have the value of "th_".
2009 Xlinesoft
Using ASPRunner.NET
40
If you want to display the images using iBox plugin check corresponding checkbox.
More info about iBox plugin here. US phone number - formats number as a US phone number. Supports 7-digit or 10-digit numbers (123) 456-7890 or 123-4567 Number - choose this format if you like to format this field as number. Two digits after decimal point implied. HTML - use this view type when you store formatted HTML code in database field and wish to display this HTML code on the list page. Checkbox - use view format to present field value as a checkbox. Works best with the following datatypes: MS Access: Yes/No field SQL Server: TINYINT or BIT field MySQL: TINYINT
2009 Xlinesoft
41
ASPRunner.Net manual
Oracle: NUMBER(1)
"Edit as" formats Text field Text area Password Date Radio button File/Image Lookup Wizard Readonly Fields format you've chosen is preserved on the Advanced search page, for example, drop-
2009 Xlinesoft
Using ASPRunner.NET
42
down boxes, date-pickers, checkboxes formats. Text field - simple text box
Text area - mutlitrow text area. For advanced WYSIWYG edit capabilities check off "Use Rich Text Editor" checkbox.
2009 Xlinesoft
43
ASPRunner.Net manual
More info about choosing Rich Text Editor. Password - password field. All entered characters appear as "*".
2009 Xlinesoft
Using ASPRunner.NET
44
Date - date edit control. You can choose between simple edit text box, drop-down boxes with day, month and year selection, and advanced datepicker.
2009 Xlinesoft
45
ASPRunner.Net manual
Radio-button - use a radio button control to limit a user's selection to a single value within a set of values.
2009 Xlinesoft
Using ASPRunner.NET
46
Checkbox - checkbox control. Works best with the following datatypes: MS Access: Yes/No field SQL Server: TINYINT or BIT field MySQL: TINYINT Oracle: NUMBER(1) Image/File- depending on field type this control allows to upload images and files to the database (binary field) or to some directory on the Web server (text field). ASPRunner.NET also makes it possible to create thumbnails on the fly. If you want to do this then you should select the appropriate checkbox and: Binary field - choose thumbnail size and the field name in which the thumbnail will be saved.
2009 Xlinesoft
47
ASPRunner.Net manual
For example, if the original image file's name is example.gif and thumbnail file's name is th_example.gif correspondingly then the thumbnail prefix should have the value of "th_". Note: To work with thumbnails you need to have ASPJpeg component installed on the Web server. Most Web hosting companies have this component installed. Lookup wizard - drop-down box with list of values. Readonly - use this format for a field that should not be edited.
2009 Xlinesoft
Using ASPRunner.NET
48
You can choose one of the following validation types to validate data that users enter on the add/edit page. If field value doesn't match defined format, web page users will see message box saying what need to be changed. Here is a sample message box:
2009 Xlinesoft
49
ASPRunner.Net manual
List of validation types Credit Card - valid credit card number. Currency - numeric value. Decimal point is allowed. Examples: 13, 24.95, ... Email - field value should be a valid email address. Number - field value should be a number. Password - password field cannot be blank, cannot be 'Password' and should be at least 4 characters long. US Phone Number - numbers, spaces, hyphens and parenthesises are allowed. Examples: (123) 456-7890, 123 456 7890, 123 4567, ... US SSN - nine digit US social security number. Valid formats: 123-45-6789 or 123 45 6789 US State - this field should be two letter US state abbreviation. Examples: AK, AL, CA, MN, ... US Zip Code - five or ten digit number. Valid formats: 12345, 12345-6789 or 123456789
2009 Xlinesoft
Using ASPRunner.NET
50
Lookup wizard - dropdown box with list of values. List of values can be entered manually or retrieved from database table (Lookup table).
Custom Display field Also you can use Custom Expression for Display field to display in dropdown box several values from different fields with custom design.
2009 Xlinesoft
51
ASPRunner.Net manual
WHERE expression The WHERE expression allows to sort dropdown box content. In our example if you put "phone like '%555%'" into WHERE box only Contacts with 555 in phone number will be displayed.
Add new items on the fly This option puts Add new link next to dropdown box allowing to add new items right on
2009 Xlinesoft
Using ASPRunner.NET
52
Edit/Add page.
Lookup wizard as Edit box with AJAX popup This feature is explained in the following article Lookup wizard as list with search Once Select button is clicked user is presented with the searchable lookup table. Lookup table appearance is fully customizable in Visual Editor. List of values
2009 Xlinesoft
53
ASPRunner.Net manual
Multiline If you set Multiline to any value greater then one this field will appear as a listbox on Add/ Edit pages. To select multiple entries hold Ctrl key while choosing values.
2009 Xlinesoft
Using ASPRunner.NET
54
Linked dropdown boxes You can use dependent dropdown boxes, where values shown in the second dropdown box depend on the value youve chosen in the first one. To do it, check in the dependent dropdown box This dropdown is dependent on ... Choose Category control - field, defining list of categories and Category field field from dependent table, containing category value.
2009 Xlinesoft
55
ASPRunner.Net manual
You can also use chain of dependent dropdown boxes. For example, Supplier field content can depends on Products field, which in its turn depend on Products category field.
2009 Xlinesoft
Using ASPRunner.NET
56
Also you can have more than one dependent dropdown box tied to the same master dropdown control.
2.14
Events
Events are the fragements of ASP.NET code executed before or after record was added, edited, deleted, when new user registers etc. Typical events are: send an email with old or new data record, save data in another table, check record uniqueness, show related to current record info. Double click on the Event name to choose one of the predefined actions. More about events, actions and sample code
2009 Xlinesoft
57
ASPRunner.Net manual
Modify sample event code putting correct email addresses, table and field names etc.
2.15
Select output directory where you like to put generated ASP.NET files and include files. If you are running Internet Information Server (IIS) on your machine, you can choose existing virtual directory where you like to put files or create new virtual directory.
2009 Xlinesoft
Using ASPRunner.NET
58
Here is the full list of files to be created ( <TABLE_NAME> will be replaced with the actual table name, Cars in this example): - index.htm: redirects user to the login page or to the list page - <TABLE_NAME>_list.aspx, <TABLE_NAME>_list.aspx.*: displays list of records and search boxes - <TABLE_NAME>_edit.aspx, <TABLE_NAME>_edit.aspx.*: edit record page - <TABLE_NAME>_add.aspx, <TABLE_NAME>_add.aspx.*: add record page - <TABLE_NAME>_search.aspx, <TABLE_NAME>_search.aspx.*: advanced search page - login.aspx, login.aspx.*: contains username/password validation code - imager.aspx, imager.aspx.*: displays database images (JPEG, GIF, BMP)
2009 Xlinesoft
59
ASPRunner.Net manual
- uploader.aspx, uploader.aspx.*: uploads binary images and files into database - getfile.aspx, getfile.aspx.*: extracts and downloads binary files from database - <TABLE_NAME>_print.aspx, <TABLE_NAME>_print.aspx.*: display printerfriendly version of the page - <TABLE_NAME>_export.aspx, <TABLE_NAME>_export.aspx.*: exports data to Word, Excel, XML or CSV - Web.config: Application Configuration Files - build.bat: Batch file for project compilation - Include\style.css: cascading style sheet for the application - Include\ts_picker.js: javascript-based datepicker - Images\icon_delete.gif: DELETE icon - Images\icon_edit.gif: EDIT icon - Images\icon_key.gif: KEY FIELD icon - Images\icon_required.gif: REQUIRED FIELD icon - Images\cal.gif: calculator image icon - Images\next.gif: next month icon - Images\prev.gif: previous month icon - Images\printer.gif: "printer-friendly version" icon - Images\word.gif: Export to Word icon - Images\excel.gif: Export to Excel icon - Images\xml.gif: Export to XML icon - Images\csv.gif: Export to CSV icon
2.16
After you successfully built ASP.NET files you have the following options:
2009 Xlinesoft
Using ASPRunner.NET
60
Testing ASP.NET pages locally View in browser - view how your ASP.NET application works. This button will be disabled if you don't have Internet Information Server or Personal Web Server running on your box. It will be disabled also if you didn't choose any virtual directory on the previous step. Open Output Folder - open Windows Explorer to browse the folder with generated ASP. NET files. Testing ASP.NET pages on the remote Web server To upload files to the remote Web server you can use builtin FTP client. If your website supports Frontpage Extensions use Frontpage publishing feature. Also you can open a Demo Account with us and publish your project to our demo web server with a single mouse click.
If you prefer to use third-party tools to upload generated applications check the following articles:
2009 Xlinesoft
61
ASPRunner.Net manual
Uploading generated application using third-party FTP client Uploading generated application using Frontpage If you having problems using ASPRunner.NET or like to learn some advanced techniques you can check ASPRunner.NET Frequently Asked Questions or ask your own question in support forum. Also you can read ASPRunner.NET's "How-to" articles to learn more how you can customize generated ASP.NET code. Also you can send an email to our support team to get an answer on your questions.
2.17
FTP upload
To upload files to FTP you need to setup FTP location properties. Enter Host name, User, Password to make Browse button enabled. Click Browse to choose directory to upload generated files. If your web hosting provider has a designated folder for databases you need to move database file to that directory. Connection string will be updated to match new database folder automatically.
If you have connected to database succesfully but can't create folder or upload files you can use Passive mode. Fill Remote Web site URL textbox to open downloaded pages in browser for test purposes. To upload files choose FTP location and click Upload button. You can stop upload at any time by clicking Stop button.
2009 Xlinesoft
Using ASPRunner.NET
62
You can choose between the following File options: Upload changed files only - to upload files that were changed since previous upload. Upload all files - to upload all generated files. Upload all files in the output directory (including all files that weren't t created by ASPRunner.NET).
2.18
FrontPage Publishing
To upload files with FrontPage Server Extension you need to setup FrontPage location properties. Enter Host name, User, Password to enable Browse button. Click Browse to choose directory to upload generated files. If your web hosting provider has a designated folder for databases you need to move database file to that directory. Connection string will be updated to match new database folder automatically.
2009 Xlinesoft
63
ASPRunner.Net manual
Fill Remote Web site URL textbox to open downloaded pages in browser for test purposes. To upload files choose FrontPage location and click Upload button. You can stop upload at any time by clicking Stop button.
You can choose between the following File options: Upload changed files only - to upload files that were changed since previous upload. Upload all files - to upload all generated files. Upload all files in the output directory (including all files that weren't t created by ASPRunner.NET).
2009 Xlinesoft
Advanced topics
64
3
3.1
Advanced topics
Master-details relationship
A one-to-many relationship, often referred to as a "master-detail" or "parent-child" relationship, is the most usual relationship between two tables in a database. Common scenarios include customer/purchase data, patient/medical-record data, and student/course-result data. For example, each customer is associated with at least one order record. Valued customers have many order records involving significant sums and often a user needs to view one in connection with the other. In a one-to-many relationship, a record in Table A can have (none or one or) more than one matching record in Table B, but for every record in Table B there is exactly one record in Table A. For example, say you have Orders table and Order Details table , where order number is a common field in each. You can create a master-detail relationship that will enable you to navigate through the Orders and jump to Order Details that belong to current order only.
3.2
AJAX-based Functionality
ASPRunner.NET comes with AJAX-based functionality added. Now you can search information more easily than ever with google-like auto-suggest feature. Web pages with AJAX driven dependent dropdown boxes are loaded faster. If you want to see details records
2009 Xlinesoft
65
ASPRunner.Net manual
you just need to mouse over the link, and you don't need to proceed to the Details page. Also new feature for lookup fields was added. Now you can choose the variant from suggest list which is refreshed each time while you are typing in the text box instead of searching through all values in the dropdown boxes.
AJAX-based Auto-Suggest
This feature comes in two versions and is enabled on the Basic and Advanced search pages. It is similar in fashion to that of Google Suggest using AJAX technologies. Search suggest makes your site much more user friendly. To see how it will look like just begin to type in the search box. The picture below demonstrates the search suggest feature on the basic search page:
2009 Xlinesoft
Advanced topics
66
By default, search suggest results include only those values that begin with the search phrase. If you want to be shown all values in which the search phrase presents to be shown you should change the suggestAllContent variable value in the dbcommon.asp file to True. In this case the search phrase in the search suggest results will be highlighted as shown on the picture below:
2009 Xlinesoft
67
ASPRunner.Net manual
The number of records in the details preview is limited. Only first ten details are displayed. If there is an image in the details then only first five details are displayed.
2009 Xlinesoft
Advanced topics
68
After you build your project, you can see how it works on the Edit, Add, and Search pages. When you begin to type in the edit box AJAX popup appears and you can choose the needed value from the suggest list. If you type in the text box the value which doesn't exist in the database and move to another form control then the border of the text box will change colour into red. When you correct the value, it will change back to usual.
2009 Xlinesoft
69
ASPRunner.Net manual
If you try to submit the form with wrong value entered in the text box then the form will be submitted with the previous correct value entry.
3.3
3.3.1
Connecting to database
Connecting to MS Access database
Run ASPRunner.NET and choose MS Access option on database connection screen. Click Next >>.
2009 Xlinesoft
Advanced topics
70
2009 Xlinesoft
71
ASPRunner.Net manual
If connection is successful, you will see list of datasource tables on the next screen.
2009 Xlinesoft
Advanced topics
72
3.3.2
Run ASPRunner.NET and choose Microsoft SQL Server option on database connection screen. Click Next >>.
2009 Xlinesoft
73
ASPRunner.Net manual
Choose SQL Server ODBC driver from the list of available ODBC drivers and click Next >> . Select server name from drop-down list. Type User and Password. Click Connect and choose required database name from drop-down list. Click Next >>.
2009 Xlinesoft
Advanced topics
74
If connection is successful, you will see list of datasource tables on the next screen.
2009 Xlinesoft
75
ASPRunner.Net manual
3.3.3
Before connecting to MySQL database make sure you have MySQL ODBC driver installed. This driver available on the Web here. Run ASPRunner.NET and choose MySQL option on database connection screen. Click Next >>.
2009 Xlinesoft
Advanced topics
76
Type host name (usually localhost), database name, user name, password and click OK to connect.
2009 Xlinesoft
77
ASPRunner.Net manual
If connection is successful, you will see list of datasource tables on the next screen.
2009 Xlinesoft
Advanced topics
78
3.3.4
Run ASPRunner.NET and choose Oracle option on database connection screen. Click Next >>.
2009 Xlinesoft
79
ASPRunner.Net manual
Choose Microsoft ODBC for Oracle from the list of available ODBC drivers and click Next >>. Type user name, password, server name and click OK to connect.
2009 Xlinesoft
Advanced topics
80
If connection is successful, you will see list of datasource tables on the next screen.
2009 Xlinesoft
81
ASPRunner.Net manual
3.4
3.4.1
When you have created a set of ASP.NET pages with ASPRunner.NET Professional, you may use any FTP client to upload them on a remote Web server. We will show you how to do it using popular FTP client WS_FTP Pro as an example.
2009 Xlinesoft
Advanced topics
82
First of all, create your FTP server connection using WS_FTP Pro Connection Wizard. Follow the directions in the Connection Wizard - type in server name or IP address, username and password. Set connection type to FTP and connect to remote FTP server.
2009 Xlinesoft
83
ASPRunner.Net manual
On the left panel (your local box) proceed to the directory you have chosen as output directory in ASPRunner.NET Professional (C:\Program files\ASPRunner.NET\Output in our example).On the right panel you may see folders of your remote Web server. Create a new folder on the remote server, name it ASPRunner.NET and open it. Select all files on the left panel (menu Edit - Select All) and click the Upload button. When all necessary files have been copied to the Web server, start browser, type the name of your Web site in the address line and add "/the name of the folder you just made" after it. In our example, it will be: http://www.xlinesoft.com/test/ASPRunner.NET/
2009 Xlinesoft
Advanced topics
84
3.4.2
Here is how files generated by ASPRunner.NET can be published on the Web using Frontpage: Run ASPRunner.NET. Point it to your database and create your ASP.NET pages. Lets assume that your output folder is C:\Program files\ASPRunner.NET\Output
2009 Xlinesoft
85
ASPRunner.Net manual
Start Frontpage. Select "File - New - Web". Select "Import Web Wizard". Enter your Web site address in the address box (i.e. http://www.yourservername.com/ASPRunner.NET) and click "Ok". On the "Import Web Wizard" dialog, select ASPRunner.NETs' output directory (C: \Program files\ASPRunner.NET\Output) as a source. Include subfolders and click "Next". Exclude files that you don't need and click "Next". Click "Finish". Now your Web site is up and running at http://www. yourservername.com/ASPRunner.NET
2009 Xlinesoft
Advanced topics
86
3.5
3.5.1
Demo Account
What is the Demo Account
Demo Account is a free service provided by Xlinesoft.com to ASPRunner.NET customers. By using Demo Account you agree to the following Terms and Conditions. Demo Account allows you quickly put ASP.NET application generated by ASPRunner.NET to our demo web server (http://demo.asprunner.net) for testing purposes. You may find this feature useful if: you don't have a web server on your local box to test ASP.NET pages you don't have a webhosting account yet you need to show generated application to your boss, friends or to support staff To open and use Demo Account proceed to the Finished tab in ASPRunner.NET and click Demo Account button. To create an account enter your email and password. You will need this info to manage your account online. After account is created use Upload button to transfer ASP.NET application to the web server. After successfull upload this application will open in browser. Demo Account transfers generated pages and your database to the server. Currently supported databases are MS Access, SQL Server, MySQL. To manage your account online proceed to http://demo.asprunner.net/Account/ AccountView.aspx. You can browse uploaded projects, delete projects etc. Demo account limitations: Since this account is designed for demo purposes only first 100 data records in each tables with be transferred to the server. Maximum disc space per account is 5Mb. If you are interested in opening a full featured webhosting account that supports one click publishing rigth from ASPRunner.NET contact our support team for more details.
2009 Xlinesoft
87
ASPRunner.Net manual
3.5.2
Xlinesoft.com Demo Account Terms and Conditions Agreement between User and Xlinesoft.com A violation of any of the below Terms and Conditions will result in the termination of your account, with or without warning. We provides free demo account for our users. Xlinesoft.com reserves the right to cancel any account for any reason or no reason at all. Xlinesoft.com provides this service to any user that abides to our terms and conditions. Failure to abide to these rules will result in account termination. Furthermore, any one who conducts illegal activities may be prosecuted and personal information disclosed to the appropriate authority. Xlinesoft.com reserves the right to change the terms and conditions at any time and it is the members responsibility to check for any updates of these terms. You are entirely liable for all activities conducted through your account. Your use of the Xlinesoft.com Demo Account is conditional upon your acceptance without modification of the terms, conditions and notices contained herein. Your use of our Services constitutes your agreement to all such terms, conditions and notices. The following rules apply while using Xlinesoft.com Demo Account: 1. Sign Up - Basic Terms 1.1 Upon after creating a Demo Account through Xlinesoft.com software you will become a user of Xlinesoft.com Demo Account. 1.2 Xlinesoft.com does not issue credits for outages incurred through service disablement resulting from Terms and Conditions violations. 2. Modification of Terms of Service 2.1 We reserve the right to change the terms and conditions of this agreement at any time without prior notice. Such changes will be posted on our web site at www.xlinesoft.com. You agree to review any changes to this agreement and, if such changes are not acceptable to you, immediately terminate your use of the Xlinesoft.com Demo Account. If you continue to use the Xlinesoft.com service after the effective date of such changes, such use will constitute acceptance of the changes. 3. Modifications to Xlinesoft.com Demo Account 3.1 By accepting this Agreement, you hereby acknowledge and agree that, in our sole discretion, we may modify or discontinue, temporarily or permanently, any aspect of the Xlinesoft.com Demo Account at any time with or without prior notice, including, without limitation, modification or discontinuance of advertising, content and applications appearing as part of the Xlinesoft.com Demo Account. You agree that we will not be liable to you or to any third party for any modification, suspension or discontinuance of the Xlinesoft.com Demo Account. 4. Privacy 4.1 Xlinesoft.com adheres to a Privacy Statement and will not release any confidential
2009 Xlinesoft
Advanced topics
88
information about you unless required by law or regulatory authority or while assisting an investigation concerning fraud.
5. No Unlawful or Prohibited Use, Spam and Termination 5.1 Xlinesoft.com Demo Account may be used for lawful purposes only. As a condition of your use of the Xlinesoft.com Demo Account, you agree that you will not use our Website for any purpose that is unlawful, illegal or prohibited by these Terms of Services, or our other terms, conditions or notices. You agree that you will not modify, copy, distribute, transmit, reproduce, publish, license, transfer, store, sell or create derivative works from, any data, software, Services or products obtained through our Website. This includes, but is not limited to: copyrighted material; trademarks; trade secrets or other intellectual property rights used without proper authorization; material that is obscene, defamatory, constitutes an illegal threat, or violates export control laws. Examples of unacceptable content or links include: pirated software, hacker programs or archives, Warez sites, MP3, and IRC bots. Such misuse can result in the cancellation of your entire account and the blacklisting of your domains without notice. You or Xlinesoft.com may terminate your Demo Account at any time for any reason. 5.2 You agree that you will not use our Services to conduct any activity or solicit the performance of any activity that is prohibited by law or by regulatory authorities. You further agree that you will not use our Services in any manner that could disable, damage, overburden or impair our Website. We reserve the right, at our sole discretion, to deny access at any time to users who breach our policies or cause other abuses which we deem disruptive to the Xlinesoft.com or the Internet community at large. 5.4 The following are grounds for immediate termination of service without notice: 5.4.1 Sending unsolicited mass e-mails (i.e., to more than 10 individuals, generally referred to as spamming) which provokes complaints from any of the recipients; or engaging in spamming from any provider and using a Xlinesoft.com Demo Account. Xlinesoft.com will be the sole arbiter as to what constitutes a violation of this provision. Violators may be assessed a minimum administration fee of $250 and will face immediate suspension. 5.4.2 Using a Xlinesoft.com Demo Account to point to or otherwise direct traffic to any material that, in the sole opinion of Xlinesoft.com, is associated with spamming, bulk email, e-mail harvesting, warez (or links to such material), is in violation of copyright law, or contains material judged, in the sole opinion of Xlinesoft.com, to be threatening or obscene or inappropriate is considered misuse of service. 5.4.3 Xlinesoft.com Demo Account membership will be revoked and legal action taken if any of the following activities occur: a) Adult or Pornographic related b) Warez Software related c) Music Piracy Related e) Hacking Related
2009 Xlinesoft
89
ASPRunner.Net manual
f) Making available copyrighted software which has been "cracked" (e.g., copyright protection for the software has been removed) g) Making available serial numbers for software, which can be used to illegally validate or register software. h) Making available tools that can be used for no purpose other than "cracking" software. i) Containing or dealing with viruses j) Spamming k) Anything related to illegal activity 5.4.4 We do not allow any type of programs, software, or MP3 files on our server. 5.4.5 Accounts that utilize an abnormal amount of our resources will be removed. This includes, CPU, memory, bandwidth, and excessive use of auto refresh. 5.4.6 Accounts that do not have any activity for 2 months are removed from our networ 5.4.7 Violations of system or network security are prohibited and may result in criminal and civil liability. Examples include but are not limited to the following: unauthorized access, use, probing, or scanning of systems security or authentication measures, data, or traffic; interference with service to any user, host, or network including, without limitation, mail bombing, flooding, deliberate attempts to overload a system, broadcast attacks; forging of any TCP-IP packet header or any part of the header information in an email or a newsgroup posting. 5.5 We reserve the right, in our sole discretion, to suspend or terminate your access to Xlinesoft.com Demo Account at any time, without notice. We will terminate for any breach of our terms of service or for any activity that constitutes an unlawful or prohibited use as described herein. 5.6 We do whatever we can to prevent the sending of unsolicited bulk e-mail messages. If you intend to use Xlinesoft.com Demo Account to spam the Internet community, please do not register with us. 5.7 Xlinesoft.com reserves the right to reject any e-mail to or passing through a Xlinesoft. com Demo Account that engages in, permits, or allows itself to be used for spamming. 6. No Warranties/Limited Liability/Indemnification 6.1 The Xlinesoft.com Demo Account and each portion thereof is provided "as-is" without any warranties of any kind, whether express, implied, statutory or otherwise including but not limited to, any warranty that the The Xlinesoft.com Demo Account will meet your requirements, the The Xlinesoft.com Demo Account will be uninterrupted, timely, secure or error-free, or any implied warranties of merchantability, fitness for any particular purpose or non-infringement. Your use of the The Xlinesoft.com Demo Account is entirely at your own risk. You understand and agree that any content downloaded or otherwise obtained through the use of The Xlinesoft.com Demo Account is done at your own discretion and risk and that you will be solely responsible for any damages to your computer system or loss of data that results in the download of such data content. Because some jurisdictions do not
2009 Xlinesoft
Advanced topics
90
allow the exclusion or limitation of implied warranties, aspects of the above exclusion may not apply to you. In such jurisdictions, any warranties will be limited to the maximum extent permitted by applicable law. 6.2 Indemnification. You agree to defend, indemnify and hold Xlinesoft.com and all of their respective current and former officers, directors, members, shareholders, agents, and employees harmless from any claims, losses, damages, causes of action, liabilities and expenses (including attorneys fees) related to or arising out of acts or omissions of you or your employees, directors, shareholders, members, officers, agents, subsidiaries, affiliates, and/or breach of any of the foregoing representations and warranties.
3.6
3.6.1
Events
More about events
Events are pieces of ASP.NET code that executed before or after record was added, edited, deleted, when new users registers etc. Typical events send an email with old or new data record, save data in another table, check record uniqueness, show related to current record info. Typical parameters passed to events e - OleDbParameterCollection. Each field on the Add/Edit form represented as 'Field type'-'Field value' pair Example of usage: VB.NET Page.Response.Write("Field1 - "+ e["Field1"].ToString()) Where - WHERE clause that points to current record to be edited or deleted Example of usage: VB.NET
2009 Xlinesoft
91
ASPRunner.Net manual
Dim sSQLSelect As String = "select * from [Order details] where " & where Dim cn As New OleDbConnection(func.GetConnectionStr()) Dim cmdSelect As OleDbCommand = New OleDbCommand(sSQLSelect, cn) cmdSelect.CommandType = CommandType.Text ...
ASPRunner.NET comes with set of handy predefined code snippets that you can use in Events. Sample code snippets Send simple email Send email with new data Save new data in another table Insert a record into another table Check if specific record exist Display a message on the WEB page Redirect to another page Custom code Here are some real life events Show list of customer orders Check if start date is ealier than end date Before deleting a record check if related records exist Speed up data entry using events
3.6.2
3.6.2.1
Predefined actions
Send simple email
2009 Xlinesoft
Advanced topics
92
2009 Xlinesoft
93
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
94
Modify this sample code using correct email address, message subject and body.
2009 Xlinesoft
95
ASPRunner.Net manual
return true; // return true if you like to proceed with editing this record // return false in other case }
3.6.2.2
2009 Xlinesoft
Advanced topics
96
2009 Xlinesoft
97
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
98
message += ", "; message += e["Field2"].ToString(); message += "\n"; func.SendMail("test@test.com", "Sample subject", message); return true; // return true if you like to proceed with editing this record // return false in other case }
3.6.2.3
2009 Xlinesoft
99
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
100
2009 Xlinesoft
101
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
102
anotherAcme.Save("username"); } finally { } return true; // return true if you like to proceed with editing this record // return false in other case }
3.6.2.4
2009 Xlinesoft
103
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
104
2009 Xlinesoft
105
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
106
anotherAcme.Save("username"); } finally { } return true; // return true if you like to proceed with editing this record // return false in other case }
3.6.2.5
2009 Xlinesoft
107
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
108
2009 Xlinesoft
109
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
110
{ count = query.GetRecordCount(); if (count > 0) { // if record exist do something } else { // if don't exist do somthing else } } finally { } return true; // return true if you like to proceed with editing this record // return false in other case }
3.6.2.6
2009 Xlinesoft
111
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
112
2009 Xlinesoft
113
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
114
3.6.2.7
2009 Xlinesoft
115
ASPRunner.Net manual
2009 Xlinesoft
Advanced topics
116
2009 Xlinesoft
117
ASPRunner.Net manual
3.6.2.8
Custom code
2009 Xlinesoft
Advanced topics
118
2009 Xlinesoft
119
ASPRunner.Net manual
Custom code
C# public static bool BeforeEdit(System.Web.UI.Page Page, IDictionary e) { //Custom code '/put your custom code here
return true; // return true if you like to proceed with editing this record // return false in other case
2009 Xlinesoft
Advanced topics
120
3.6.3
3.6.3.1
Sample code
Show list of customer orders
Show list of all orders placed by this customer on Orders Edit page (Sample Northwind database in MS Access). C# public static void EditOnLoad(System.Web.UI.Page Page) { // get customer id string customerID = Page.Request["value_CustomerID"]; if (!string.IsNullOrEmpty(customerID)) { ordersCollection ordersCollection = new ordersCollection(); Query qry = new Query(orders.Schema).WHERE("CustomerID", customerID); ordersCollection.LoadAndCloseReader(qry.ExecuteReader()); if (ordersCollection.Count > 0) { Page.Response.Write("All orders for '" + customerID + "'<br>"); foreach (orders order in ordersCollection) { Page.Response.Write(String.Format("<a target=_blank href=Orders_edit.aspx?editid1= {0}> {0}</a>{1}<br>", order.OrderID, order.OrderDate.Value.ToShortDateString())); } } }
} // EditOnLoad
2009 Xlinesoft
121
ASPRunner.Net manual
3.6.3.2
Before deleting a record in Orders tabe check if related records exist in Order Details table (Sample Northwind database in MS Access) C# public static bool BeforeDelete(System.Web.UI.Page Page, IDictionary e) { string orderID = (string)e["key"]; // orderID - id pointing to record to be deleted. if (!string.IsNullOrEmpty(orderID)) { Order_DetailsCollection details = new Order_DetailsCollection(); Query qry = new Query(Order_Details.Schema).WHERE("OrderID", orderID); details.LoadAndCloseReader(qry.ExecuteReader()); //Check if specific record exists if (details.Count > 0) { //if record exists tell about it Page.Response.Write("You can't delete this record. Try to delete all order details for this order before"); return false; } return true; } //return true if you like to proceed with deleting record //return false in other case return false; } // BeforeDelete
2009 Xlinesoft
Advanced topics
122
3.6.3.3 Check if start date is earlier then end date On Edit page check if start date is ealier than end date. (Framework 1.1, VB.NET) C# public static bool BeforeEdit(System.Web.UI.Page Page, IDictionary e) { string strOrderDate = (string)e["OrderDate"]; string strRequiredDate = (string)e["RequiredDate"]; if (!string.IsNullOrEmpty(strOrderDate) && !string.IsNullOrEmpty(strRequiredDate)) { DateTime orderDate = DateTime.Parse(strOrderDate); DateTime requiredDate = DateTime.Parse(strRequiredDate); if (orderDate > requiredDate) { Page.Response.Write("<br>Error: OrderDate is more that RequiredDate"); return false; } return true; } //return true if you like to proceed with saving record //return false in other case return false; } // BeforeEdit
3.6.3.4
On ADD page you might want to prepopulate some edit boxes with recently used values. This can be done using combination of Default values and BeforeAdd Event.
2009 Xlinesoft
123
ASPRunner.Net manual
Let's say at the end of day you need to enter several data records for each Order. To prepopulate EmployeeID, ShipVia and Freight fields with last entered values you need to the following: 1. Set Default values of those fields to Page.Session("EmployeeID"), Page.Session ("ShipVia") and Page.Session("Freight") respectively. This can be done on the Formatting tab. 2. Use BeforeEdit Event to save EmployeeID, ShipVia and Freight values in Session variables C# Page.Session["EmployeeID"] = (string)e["EmployeeID"]; Page.Session["ShipVia"] = (string)e["ShipVia"]; Page.Session["Freight"] = (string)e["Freight"];
2009 Xlinesoft