FORUMS

c360 Forums
 Home        Members    Calendar    Who's On

Welcome Guest ( Login | Register )
      



Grid PreferencesExpand / Collapse
Message
Posted 10/17/2006 2:32:10 PMPost #707
 

c360 Product Guruc360 Product Guruc360 Product Guruc360 Product Guruc360 Product Guruc360 Product Guruc360 Product Guruc360 Product Guru
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

  Post Attachments 
GridPreferences.zip (159 views, 5.68 KB)

Posted 11/9/2006 8:58:58 AMPost #837
 

c360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expert
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


  Post Attachments 
GridPreferencesHelper.zip (136 views, 2.02 KB)
Posted 11/10/2006 5:36:36 AMPost #839
 

c360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expertc360 Product Expert
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));

}

}

« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Jeremie Desautels, john.gravely, kanika.jackson, Arvind Raman, Ken Champion

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 4:50am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.156. 11 queries. Compression Enabled.