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
515
set XamPivotGrid datasource in code
posted

Hello,

I'm trying to set the datasource in the code behind instead of the xaml. I would like to add keys to my silverlight config file to define which serveruri, database, and cube to load the grid with. Do you have an example of setting the datasource before the xaml loads?

I thought it would be as simple as doing this in my constructor:

 

 

 

 

Uri

 

 

uri = new Uri(http://sampledata.infragistics.com/olap/msmdpump.dll);

XmlaDataSource

 

 

olapsource = new XmlaDataSource { ServerUri = uri };

pivotGrid.DataSource = olapsource;

Parents
No Data
Reply
  • 7922
    posted

    Hi

    You can use the follow code:

     XmlaConnectionSettings connectionSettings = new XmlaConnectionSettings();
    connectionSettings.ServerUri =
    new Uri"http://igbgsofsltest/olap/msmdpump.dll");
    XmlaConnection xmlaConnection = new XmlaConnection(connectionSettings);
    XmlaDataProvider xmlaDataProvider = new XmlaDataProvider(xmlaConnection);
    XmlaDataSource xmlaDataSource = new XmlaDataSource(xmlaDataProvider);
    xmlaDataSource.Database =
    XmlaDataSource.GenerateInitialDatabase("Adventure Works DW 2008");

     

     

     

     

Children