Custom Bound Fields in FieldGroup
You could make the AxBoundFieldGroup use the CustomBoundField (https://blogs.msdn.com/solutions/archive/2009/04/20/ax-custom-bound-fields.aspx) instead of the regular bound field by hooking into the OnCreatingBoundField event (KB971547) of the AxBoundFieldFactory.
For example create an assembly with the below code and put it in GAC.
public
class AxSampleBoundFieldFactory
{
public void OnCreatingBoundField(object sender, CreatingBoundFieldEventArgs eventArgs)
{
if (eventArgs.Field.Name == "Date")
eventArgs.BoundField = new AxSampleDateBoundField();
}
}
Then modify the master page (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DynamicsAxEnterprisePortal\defaultax.master) and add the below code to invoke this eventhandler in page init. Now any page that displays a fieldgroup will use the AxSampleDateBoundField for any field with the name "Date". You can add any logic that you want here for example you may want to use other field meta data properties instead of the name.
private AxSampleBoundFieldFactory customBoundFieldFactory;
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// Subscribe to the bound field factory event
this.customBoundFieldFactory = new AxSampleBoundFieldFactory();
AxBoundFieldFactory.Instance.CreatingBoundField += this.customBoundFieldFactory.OnCreatingBoundField;
}
protected override void OnUnload(EventArgs e)
{
// Unsubscribe to the bound field factory event
AxBoundFieldFactory.Instance.CreatingBoundField -= this.customBoundFieldFactory.OnCreatingBoundField;
base.OnUnload(e);
}
Comments
- Anonymous
May 27, 2009
PingBack from http://microsoft-sharepoint.simplynetdev.com/custom-bound-fields-in-fieldgroup/