Change Display Name of fields
Within AdHoc, we can display another string to indicate the actually field as show below.
1. Use SetFieldDisplayName to setup the display name.
2. Call UpdateFieldChanges to confirm the change.
[Example]
//Setup fields
this.ahMain.SetFieldDisplayName("FName", "First Name");
this.ahMain.SetFieldDisplayName("LName", "Last Name");
this.ahMain.SetFieldDisplayName("Sex", "Gender");
this.ahMain.SetFieldDisplayName("dtPurchase", "Purchase Date");
this.ahMain.SetFieldDisplayName("PurchaseAmt", "Purchase Amount");
this.ahMain.SetFieldDisplayName("Sex", "Gender");
this.ahMain.SetFieldDisplayName("dtFirstPurchase", "First Purchase Date");
// Update Field Info
this.ahMain.UpdateFieldChanges();
Change Ordinal Location of field
We can also customize the display order of fields use SetFieldOrdinal Method:
[Example]
//Setup fields
this.ahMain.SetFieldDisplayName("FName", "First Name");
this.ahMain.SetFieldOrdinal("FName", 0);
this.ahMain.SetFieldDisplayName("LName", "Last Name");
this.ahMain.SetFieldOrdinal("LName", 1);
this.ahMain.SetFieldDisplayName("Sex", "Gender");
this.ahMain.SetFieldOrdinal("Sex", 2);
this.ahMain.SetFieldDisplayName("dtPurchase", "Purchase Date");
this.ahMain.SetFieldOrdinal("dtPurchase", 3);
this.ahMain.SetFieldDisplayName("PurchaseAmt", "Purchase Amount");
this.ahMain.SetFieldOrdinal("PurchaseAmt", 4);
this.ahMain.SetFieldDisplayName("Sex", "Gender");
this.ahMain.SetFieldOrdinal("Sex", 2);
// Update Field Info
this.ahMain.UpdateFieldChanges();
We need to call the UpdateFieldChanges method after SetFieldOrdinal also.
Set Visible or Invisible to Fields
The SetFieldVisibility method is used to change a field's visibility in the ad-hoc component
[Example]
//Setup fields
this.ahMain.SetFieldDisplayName("FName", "First Name");
this.ahMain.SetFieldOrdinal("FName", 0);
this.ahMain.SetFieldDisplayName("LName", "Last Name");
this.ahMain.SetFieldOrdinal("LName", 1);
this.ahMain.SetFieldDisplayName("Sex", "Gender");
this.ahMain.SetFieldOrdinal("Sex", 2);
this.ahMain.SetFieldDisplayName("dtPurchase", "Purchase Date");
this.ahMain.SetFieldOrdinal("dtPurchase", 3);
this.ahMain.SetFieldDisplayName("PurchaseAmt", "Purchase Amount");
this.ahMain.SetFieldOrdinal("PurchaseAmt", 4);
this.ahMain.SetFieldDisplayName("Sex", "Gender");
this.ahMain.SetFieldOrdinal("Sex", 2);
//Set invisible
this.ahMain.SetFieldVisibility("dtFirstPurchase",false) ;
// Update Field Info
this.ahMain.UpdateFieldChanges();
We need to call the UpdateFieldChanges method after SetFieldVisibility also.
Note :
The UpdateFieldChanges method must be called once ALL changes have been made by the routines (SetFieldDisplayName, SetFieldOrdinal and SetFieldVisibility).
Sample : Raw looks and appearance after being change the display
Raw looks
Change display
Click to read this topic
6/17/2005 12:51:51 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:54:23 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:52:56 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:54:23 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:52:56 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:53:56 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:54:23 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:53:56 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:54:23 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:51:51 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:52:56 AM - -202.67.151.99
Click to read this topic
6/17/2005 12:53:56 AM - -202.67.151.99