Posted 10/17/2006 2:32:10 PM | | | | Overview The goal of this sample is to demonstrate how the GridPreferences control can be used in conjuction with a Grid to allow the end-user to select the fields he or she wants to see. Furthermore, this sample also demonstrates how to preserve user preference and how to subsequently retrieve them. This sample demonstrates the following: - Use a Save dialog page to present the GridPreferences control.
- Read metadata about an entity and display the list of fields in the GridPreferences control.
- Save the user selections
- Use an AreaPage to display a standard grid
- Retrieve the user preferences and display only the selected fields in the Grid
Installation Step 1 – Edit ISV.config This sample must be added as a new link under a “top level” menu (i.e.: a pull down menu on the top menu bar at the top of the main CRM window). Therefore we need to edit the “CustomMenus” section in Microsoft CRM’s ISV.config file like so: <Menu Title="Testing c360 SDK"> <MenuItem Title="Grid Preferences" Url="http://localhost:5517/c360Sdk/Samples/GridPreferences/Grid.aspx" WinMode="0" Client="Web,OutlookWorkstationClient" AvailableOffline="false" /> </Menu> Note: you will need to adjust the url in the above sample to match your environment. Step 2 – Copy files In your Visual Studio 2005 project, make sure you have a folder called “Samples” and create a sub-folder called “GridPreferences”. In this new folder, copy the image, the two ASPX page and their corresponding code behind files: - 18_settings.gif
- Grid.aspx
- Grid.aspx.cs
- GridPreferences.aspx
- GridPreferences.aspx.cs
There is also one file included in this sample that must be copied to the App_Code folder in your solution: GridPreferences.cs Screenshots 



Jeremie Desautels VP, Product Marketing c360 Solutions
|
| | Posted 11/9/2006 8:58:58 AM | | | Idea: Why not allow the url to the gridpreference.aspx page to be a property See attachment.
This way you can easily create your own GridPreference class and still use the helper class. ...you should follow the GridPreference class for the parameters that are passed through...
It would be even nicer if you the GridPreferences class became available in the c360.SDK.UI.Pages dll 
|
| Posted 11/10/2006 5:36:36 AM | | | And use the ColumnType.EntityLink in ConfigureGrid in the GridPreferencesHelper:public void ConfigureGrid(IGrid grid){ grid.SortCol = this.SortField; grid.SortDir = this.SortDirection; for (int i = 0; i < this.SelectedFields.Length; i++) { ColumnType columnType = ColumnType.Normal; // use entity column type for primary field if (SelectedFields[i].Name == _entityMetadata.PrimaryField) columnType = ColumnType.EntityLink;
else { // use entity column type for refereces to from entities foreach (RelationshipMetadata relmap in _entityMetadata.ReferencesFrom) { if (relmap.ReferencingAttribute == SelectedFields[i].Name) { columnType = ColumnType.EntityLink; break;
}
}
} grid.ColumnHeaders.Add(ControlFactory.CreateColumnHeader(this.SelectedFields[i].DisplayName, this.SelectedFields[i].Name, (this.SelectedFields[i].Name == _entityMetadata.PrimaryField ? 0 : 150), columnType));
}
} |
| |
|