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
130
UltraWebChart.LoadPreset Issue
posted

Hi, currently I've been having an issue with the loadpreset method for ultrawebchart.  I have a webchart on my webpage which is bare and invisible when I create it. 

<igchart:UltraChart runat="server" Visible="false" ID="ultraChart1"></igchart:UltraChart> 

When a user clicks on a specific piece of data my code looks to see if there is a chart attached to it.  If there is then it set the visible property to true and binds the data from xml.  Here is my c# code that sets the file path for the xml file and reads through it.

            FileInfo fi = new FileInfo(FileName);
      string strDirectory = fi.Directory.Parent.FullName;
      XmlTextReader xmlReader = null;
      XmlReader reader = null;
       

      try

      {

            xmlReader = new XmlTextReader(FileName);
            XmlReaderSettings settings = new XmlReaderSettings();
            settings.IgnoreWhitespace = true;
            reader = XmlReader.Create(xmlReader, settings);
            reader.Read();
            OLAPDashboardProperties dp = new OLAPDashboardProperties(); 

           while (reader.Read())

            {

              .

                         .

                         .                       
                      
else if (reader.Value.ToString() == "Chart1Settings")            { 

            reader.Read();

            string str = reader.Value;

            ultraChart1.LoadPreset(Path.Combine(strDirectory, str), false);

            }

              .

                         .                        

                         .

The ultraChart1.LoadPreset(Path.Combine(strDirectory, str), true); line returns a “Object reference not set to an instance of an object” error.  The ultraChart1 gets set in the html, and strDirectory and str are both valid file paths.  Also I have tried the string overload method of LoadPreset and returns the same thing. 

I’m currently stumped as to why this is happening so any help will be much appreciated.  If I need to provide anymore code or explanation please ask.

Thanks for any help in advance.