|
The user interface controls defined on the page can be accessed easily within each of the page,
table control and record control classes in the code-behind file for your page. Please note that
user interface controls within a table control are initialized and defined when data is loaded into
the table control since the number of rows displayed is determine by the result set returned by the
query. As such we recommend that you make most of your code customizations at the Record Control
class level since this class is available both when displaying a single record on a page as well as
for each row within a table.
Page Class
You can access any user interface control from the page class except the controls that are repeated
for each row in a table. To access the controls from the page, you simply specify the name of the
control that is shown on the layout page. For example, if you have an Add Customer page, you may
have a field label called CompanyNameLabel and a field value text box called CompanyName. To access
this control, you can:
C#:
this.CompanyName
this.CompanyName.Text // to access the text entered by the user
|
VB.NET:
|
Me.CompanyName
Me.CompanyName.Text ' to access the text entered by the user
|
If you are displaying an Add, Edit or Show Record page, you will have a record control on the page as shown
in the control hierarchy above. The record control corresponds to the record control class in the page’s
code-behind file. If the page is a Show Table page, you will have a table control on the page and a record
control for each row in the table. Both the table control and the record control will have corresponding
classes in the page’s code-behind file. You can access the record and table controls within the page as
follows:
C#:
this.CustomersRecord // to access the record control
// to access the company name within the
// record control
this.CustomersRecord.CompanyName
this.CustomersTable // to access the table control
|
VB.NET:
Me.CustomersRecord ' to access the record control
' to access the company name within the
' record control
Me.CustomersRecord.CompanyName
Me.CustomersTable ' to access the table control
|
Table Control Class
The table control class corresponds to the table control on the page. You can directly access all
of the controls within the table except the rows of a table. To access the rows of a table, you can
either override or handle events at the record control class level, or use functions such as GetRecordControls
or GetRecords to get an array list that can loop through to get an individual row. The search, filter, pagination
and column sorting controls can be accessed directly from the table control class.
Record Control Class
We recommend most of the code customizations to be made at the record control class. The record control
class corresponds to the record being displayed on the page. If there is a table displayed on the page,
the record control class corresponds to each row within a table. The customizations will be the same
regardless of whether the record control class corresponds to a single record control or to a row within
a table.
You can access all of the fields within a record control including column values as shown below:
C#:
this.CompanyName
this.CompanyName.Text // to access the text entered by the user
|
VB.NET:
Me.CompanyName
Me.CompanyName.Text ' to access the text entered by the user
|
|