Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5991787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:26:17+00:00 2026-05-22T23:26:17+00:00

My page has a chart that is set up to display data that is

  • 0

My page has a chart that is set up to display data that is coming from a SqlDataSource.

There is a TreeView which contains a list of datapoints that I want to be able to add to the chart as different series. The user selects which item they wish to add by clicking a checkbox in the treeview for that node and then clicks an update button to refresh the chart.

Each node’s value is set to a column name in the table.

If there is only one point selected on the treeview the data comes across as a series on the chart with no problem when the update button is clicked.

If multiple items in the treeview are selected an ASP.NET error page appears when clicking the button stating that a column name ‘XXXX’ was not found where ‘XXXX’ is the node.Value of the highest item in the tree that was checked.

For example an error saying that “Column with name ‘X1’ was not found” would show up when using the following selection:

If just ‘X1’ is checked the data shows up on the chart.

public void UpdateChart(Object sender, EventArgs e)
    {

        if (TagTreeView.CheckedNodes.Count > 0)
        {
            foreach (TreeNode node in TagTreeView.CheckedNodes)
            {
                // Add a series to the chart
                Series series = new Series();
                series=Chart1.Series.Add("Series"+node.Value);
                series.ChartArea = "ChartArea1";
                series.ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), charts[1], true);
                // create a datasource, add it to the page,
                SqlDataSource sqlDataSource = new SqlDataSource();
                sqlDataSource.ID = "SQLDataSource"+node.Value;
                sqlDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["HistoricalDataConnectionString"].ConnectionString;
                if (node.Depth > 1)
                {
                    if (node.Parent.Text.Contains("AAA"))
                    {
                        MessageBox.Show(node.Value);
                        sqlDataSource.SelectCommand = "SELECT (Date + CONVERT(datetime,Time)) As TimeStamp, " + node.Value + " FROM AAA ORDER BY TimeStamp";
                    }

                    this.Page.Controls.Add(sqlDataSource);
                    Chart1.DataSourceID = "SQLDataSource"+node.Value;

                    Chart1.Series["Series" + node.Value].XValueMember = "TimeStamp";
                    Chart1.Series["Series" + node.Value].YValueMembers = node.Value;

                    Chart1.DataBind();
                }
            }
        }
    }

Is there a way to take each selected item in the TreeView and use the node.value to build a query to add an additional series to the chart? I have done a little bit of work to see if putting the SqlDatasource and Series objects into an array and looping through that but it doesn’t seem to be taking me anywhere.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:26:17+00:00Added an answer on May 22, 2026 at 11:26 pm

    To get this to work correctly all of the datapoints that will be added to the chart need to be included in the select statement for the sqlDataSource:

    sqlDataSource.SelectCommand = "SELECT (Date + CONVERT(datetime,Time)) As TimeStamp, X1, X2, X3 FROM AAA ORDER BY TimeStamp";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my Page has many hover images, sometimes there are backgrounds from div-elements or src
My view page has a Model which is represented by a List of Students.
Page has menu items that would replace a 'div id=foo_(current menu item)' with 'div
The page has a container div which holds multiple content divs. Each content div
My page has 3 divs that are located horizontally. I need to make the
This Wikipedia page has an extensive list of hashing methods As you can see,
If a page has both JQuery and Prototype then I got conflict. There is
I have an ASP.NET MVC Page that i have to display the fields in
I am migrating data from a Oracle on VMS that accesses data on SQL
I have a javascript file linked to a PHP page which has a value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.