Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
530
How to export to Excel the contents of a GroupCell in a XamGrid
posted

I have tried to follow the example in the documentation for XamGrid Export to Excel at http://help.infragistics.com/Help/NetAdvantage/Silverlight/2011.1/CLR4.0/html/SL_Exporting_xamGrid_Data_to_Excel.html, and it does not work in my case. Some of my columns are GroupColumns. For example, the "Security Id" and "Security Name" columns are inside a "Security" GroupColumn. When I implement the Export to Excel logic in codebehind, and loop through the cells of each row, only the GroupCell appears in the collection of cells, and the Value property of this is null.

There are no obvious properties of this object that would allow me to pull the value of the child columns (e.g. Security Id).

How do I implement Export to Excel if my grid uses GroupColumns?

Parents
  • 21382
    posted

    When you are looping through the cells are you using the columns of the column layout to provide you with the keys to find the cell?

     

    If you are then you need to look inside the GroupColumn to find the columns that are under it.  The Grid already has a  mechanism for this, the .AllColumns collection off the Columns collection

    columnLayout.Columns.AllColumns

    This gives you a recursive list of all columns under the column layout.  As you cycle your columns just omit the GroupColumn.

     

    foreach (Column c in columnLayout.Columns.AllColumns)

      if ( c  is GroupColumn) 

      continue;

     

    // otherwise export

     

Reply Children