I have a DataTable that is populated by an MDX query. I want to bind that DataTable to a GridView and show all data that is returned. My GridView is defined like this:
<asp:GridView ID = "gvResults" runat="server" AutoGenerateColumns="true" />
MDX query is called as follows:
DataTable mdxResults = new DataTable();
CellSet cellSet;
AdomdCommand command = new AdomdCommand();
strCommand = "SELECT NON EMPTY({[Measures].[Assets Distinct Count], [Measures].[Value]}) " +
"ON COLUMNS, NONEMPTY({[Organization].[Org Id].[Org Id]*[Location].[Loc Id].[Loc Id]}) " +
"ON ROWS FROM [database]"
command.Connection = _CurrentConnection;
command.CommandText = strCommand;
cellSet = command.ExecuteCellSet();
AdomdDataAdapter dataAdapter = new AdomdDataAdapter(command);
objDataAdapter.Fill(mdxResults);
An example of a DataTable that could be produced from the MDX query:
Organization Location Assets Value
Org A Los Angeles 12 320000
Org B San Jose 6 21000
Assets and Value are aggregated measures from the MDX query.
The DataTable is then bound to the GridView after I rename columns:
gvResults.DataSource = mdxResults;
gvResults.DataBind();
After I bind the DataTable only a subset of the columns display in the GridView. Specifically, all columns but the Measure columns from the MDX query will display.
Any help would be appreciated.