We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to create olapgrid in code

code:
/// <summary>
        /// Samples the browser settings.
        /// </summary>
        public OlapGrid og = new OlapGrid();
        public WaitingPopup ow = new WaitingPopup();
     

        protected void Page_Load(object sender, EventArgs e)
        {
            AdomdDataProvider dataProvider = null;
            if (dataProvider == null)
            {
                string connectionString = "Datasource='C:\\Syncfusion\\11.2.0.25\\Common\\Data\\OfflineCube\\ASP\\Adventure_Works_Ext.cub'; Provider=msolap;";
                if (connectionString != null)
                {
                    dataProvider = new AdomdDataProvider(connectionString);
                    Session["DataProvider"] = dataProvider;
                }
            }
            if (dataProvider != null)
            {
                
                og.ID = "og";
                if (!IsPostBack)
                {
                    //// Data binding
                    OlapDataManager DataManager = new OlapDataManager(dataProvider);
                    DataManager.SetCurrentReport(SimpleReport());
                    og.OlapDataManager = DataManager;
                    og.DataBind();
                }

                GridContainer.ContentTemplateContainer.Controls.Add(og);
                ow.DisableOnShowElementID = "og";
                GridContainer.ContentTemplateContainer.Controls.Add(ow);

            }
     

            
        }

error:
[NullReferenceException: 未将对象引用设置到对象的实例。]
   Syncfusion.Web.UI.WebControls.Olap.Locale.OlapResourceManager.get_ResourcePath() +38
   Syncfusion.Web.UI.WebControls.Olap.Locale.OlapResourceManager.EnsureResources(Boolean isDefaultCulture) +93
   Syncfusion.Web.UI.WebControls.Olap.Locale.OlapResourceManager.EnsureResources() +52
   Syncfusion.Web.UI.WebControls.Olap.Locale.OlapResourceManager.get_Resources() +40
   Syncfusion.Web.UI.WebControls.Olap.Locale.OlapResourceManager.GetString(String name) +34
   Syncfusion.Web.UI.WebControls.Grid.Olap.CellDetailsToolTip..ctor(OlapGrid grid) +69
   Syncfusion.Web.UI.WebControls.Grid.Olap.OlapGrid.CreateChildControls() +3351
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

7 Replies

PS Prabu S Syncfusion Team July 11, 2013 09:42 AM UTC

Hi Robert,

We would like to inform you that we have created an incident for follow-up regarding this query under direct-trac support system (Incident ID: 110593).

Please let us know if you have any query.

Regards,

Prabu S.


ER ericpoon September 12, 2013 04:16 AM UTC

Hello,

I would like to know ho to create the olap grid in code too, i got the following error:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   Syncfusion.Web.UI.WebControls.Shared.PopupControl.PopupBase.SetViewStateValue(String sKey, Object oValue, Object oDefaultValue) +15
   Syncfusion.Web.UI.WebControls.Shared.WaitingPopup.SetViewStateValue(EViewStateKeys eKey, Object oValue) +75
   Syncfusion.Web.UI.WebControls.Shared.WaitingPopup.set_DisableOnShowElementID(String value) +10
   Syncfusion.Web.UI.WebControls.Grid.Olap.OlapGrid.AddWaitingPopup() +31
   Syncfusion.Web.UI.WebControls.Grid.Olap.OlapGrid.CreateChildControls() +2256
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


PS Prabu S Syncfusion Team September 16, 2013 05:53 PM UTC

Hi Robert,

 

We are not able to reproduce the reported problem and kindly ensure the patch provided through direct-trac support system (Incident ID: 110593) is correctly installed.

 

Please  find the sample in following link. In the sample OlapGrid is created through code-behind.

http://www.syncfusion.com/uploads/user/directTrac/110593/OlapGrid_ThroughCode-1566539660.zip

 

Please let us know if you want any further assistance.

 

Regards,

Prabu S.



SP saglietto piermaria March 3, 2015 07:28 AM UTC

Hello,
I have the same problem of ericpoon an I can't download the .zip file. Can anyone help me to solve the problem?

Thanks

Regads


RG Ramesh Govindaraj Syncfusion Team March 4, 2015 11:05 AM UTC

Hi Robert,

Sorry for the inconvenience caused.

Please find the sample in the below link.

Sample Link:

http://www.syncfusion.com/downloads/support/directtrac/109896/grid_code_behind-1266291619.zip

Please let us know if you have any concern.

Thanks,

Ramesh. G




SP saglietto piermaria March 4, 2015 04:24 PM UTC

Thanks, I've solved the problem.

Regards


AD Alagarsamy D Syncfusion Team March 5, 2015 01:11 PM UTC

Hi Robert,
 
Thanks for the update.
 
Thanks,
Alagarsamy D.



Loader.
Live Chat Icon For mobile
Up arrow icon