You can easily bind C1OlapPage or C1Olap to a data source using the C1OlapPage.DataSource or C1OlapPanel.DataSource property. For this example, we load Northwind product data from an XML data schema file. Note that the nwind.zip is installed with the OlapQuickStart sample. We use ComponentOne Data, which provides us the familiar DataSet and DataTable objects to read the data in. We also use ComponentOne Zip to unpackage the zipped XML file on the client.
To bind the C1OlapPage control, follow these steps:
Visual Baisc |
Copy Code
|
---|---|
' load data from embedded zip resourcevar ds = new DataSet(); Dim asm = Assembly.GetExecutingAssembly() Using s = asm.GetManifestResourceStream("OlapQuickStart.nwind.zip") Dim zip = New C1ZipFile(s) Using zr = zip.Entries(0).OpenReader() ' load data ds.ReadXml(zr) End Using End Using |
C# |
Copy Code
|
---|---|
// load data from embedded zip resourcevar ds = new DataSet(); var asm = Assembly.GetExecutingAssembly(); using (var s = asm.GetManifestResourceStream("OlapQuickStart.nwind.zip")) { var zip = new C1ZipFile(s); using (var zr = zip.Entries[0].OpenReader()) { // load data ds.ReadXml(zr); } } |
Visual Basic |
Copy Code
|
---|---|
// bind olap page to data
_c1OlapPage.DataSource = ds.Tables[0].DefaultView;
|
C# |
Copy Code
|
---|---|
// bind olap page to data
_c1OlapPage.DataSource = ds.Tables[0].DefaultView;
|