|
Step 1: Handle the PostGetUIData event in the Page class of AddOrdersPage.aspx. Use the
SetDataAccessSettingsParameterValue method to pass the value of the ASPX text box.
The SetDataAccessSettingsParameterValue method has two arguments. The first argument is a key and the
second argument is its value. In the code below, “MYKEY” is the key and its value is “myKeyValue”. The
SetDataAccessSettingsParameterValue method can be called in any event or method and, in this example, is
called in the PostGetUIData event in the AddOrdersPage class.
The DataAccessSettings class is used to retrieve the value of the ASPX text box in the Data Access Layer.
C#:
public AddOrdersPage()
{
this.PreRender += new EventHandler(AddOrdersPage_PreRender);
}
private void AddOrdersPage_PreRender(object sender, System.EventArgs e)
{
this.SystemUtils.SetDataAccessSettingsParameterValue("MYKEY", "myKeyValue");
}
|
Visual Basic .NET:
Private Sub AddOrdersPage_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
Me.SystemUtils.SetDataAccessSettingsParameterValue("MYKEY", "myKeyValue")
End Sub
|
Step 2: Add the code in the OrdersRecord.cs file.
For .NET Framework 1.1, OrdersRecord.cs is located in:
|
...\Application Folder\DataAccess\OrdersRecord.cs
|
For .NET Framework 2.0, OrdersRecord.cs is located in:
|
...\Application Folder\App_Code\Business Layer\OrdersRecord.cs
|
C#:
public OrdersRecord()
{
this.InsertedRecord+= new
BaseClasses.IRecordWithTriggerEvents.InsertedRecordEventHandler(O
rdersRecord_InsertedRecord);
}
private void OrdersRecord_InsertedRecord(object sender,System.EventArgs e)
{
DataAccessSettings dataAccessSettingsObj = DataAccessSettings.Current;
if(dataAccessSettingsObj.ContainsKey("MYKEY"))
{
String myKey = (String)dataAccessSettingsObj["MYKEY"];
//Retrieve the value of SignedInUserId and SignedInUserName
String myUserID = dataAccessSettingsObj.SignedInUserId;
String myUserName = dataAccessSettingsObj.SignedInUserName;
/Add your Business logic
}
}
|
Visual Basic .NET:
Private Sub OrdersRecord_InsertingRecord(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.InsertingRecord
Dim dataAccessSettingsObj As DataAccessSettings = DataAccessSettings.Current()
If dataAccessSettingsObj.ContainsKey("MYKEY") Then
Dim myVal As String = DirectCast(dataAccessSettingsObj("MYKEY"), String)
'Retrieve the value of SignedInUserId and SignedInUserName
Dim myUserID As String = dataAccessSettingsObj.SignedInUserId
Dim myUserName As String = dataAccessSettingsObj.SignedInUserName
'Add your Business logic
End If
End Sub
|
Note that you can retrieve the value of a control in any of the events available in the OrdersRecord.cs
or vb based on where your business logic is to be added. The events available in OrdersRecord.cs or vb are:
InsertingRecord
InsertedRecord
SavingRecord
SavedRecord
DeletingRecord
DeletedRecord
UpdatedRecord
UpdatingRecord
|