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

  • SEARCH
  • Home
  • 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 8157691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:22:12+00:00 2026-06-06T17:22:12+00:00

I want to dynamically add chart controls inside my ul tags through code. How

  • 0

I want to dynamically add chart controls inside my ul tags through code. How can I do this?
This is my statement for the anythingslider javascript

<script type="text/javascript">
     var slider2 = ['Machines', 'Trend','test','test2','test3'];
     function formatText(index, panel) {
         return slider2[index - 1];
     }

     $(function () {
         $('#slider2').anythingSlider({
             width: 800,       // if resizeContent is false, this is the default width if panel size is not defined
             height: 400,       // if resizeContent is false, this is the default height if panel size is not defined
             buildArrows: true,
             resizeContents: false,     // If true, solitary images/objects in the panel will expand to fit the viewport
             autoPlay: true,     // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
             navigationFormatter: formatText, // Format navigation labels with text
             forwardText: "&raquo;",
             backText: "&laquo;"
         })
     });
</script>

Edit:
This is the source code to the page with the new added code:

<ul id="MainContent_slider2">
<img id="MainContent_PlantMachineChart" src="/ChartImg.axd?i=chart_93717cef16e84387b35d83bdd04da217_0.png&amp;g=898a170672b0476ca6f6d49173c231b1" alt="" usemap="#MainContent_PlantMachineChartImageMap"    style="height:400px;width:868px;border-width:0px;" />

<map name="MainContent_PlantMachineChartImageMap"  id="MainContent_PlantMachineChartImageMap">
 </map>

 <li><img id="MainContent_ctl01" src="/ChartImg.axd?    i=chart_93717cef16e84387b35d83bdd04da217_1.png&amp;g=23020f9898ab40898782de3234fae6e4"    alt="" style="height:400px;width:868px;border-width:0px;" /></li'><li'><img    id="MainContent_ctl03" src="/ChartImg.axd?   i=chart_93717cef16e84387b35d83bdd04da217_2.png&amp;g=aa749f6279484859a7892f1f117fbd1c"    alt="" style="height:400px;width:868px;border-width:0px;" /></li></ul>

It has all the data points listed for the first chart(which I left out here) which isn’t added dynmically.

  • 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-06-06T17:22:14+00:00Added an answer on June 6, 2026 at 5:22 pm

    I dont really know why you would want to do this, but you can make the ul runat="server" and add the controls to it like so:

    HTML:

    <ul runat="server" ID="ul_Charts"></ul>
    

    ServerSide:

    ul_Charts.Controls.Add(yourControl);
    

    Edit: You need to programmatically create the chart and insert the chart control into your element like this:

    // Create a pie chart
    Chart chart = new Chart();
    
    // Choose chart type and add series info
    Series series = new Series("Default");
    series.ChartType = SeriesChartType.Pie;
    chart.Series.Add(series);
    
    // Create chart legend
    Legend legend = new Legend();
    chart.Legends.Add(legend);
    
    // Define the chart area
    ChartArea chartArea = new ChartArea();
    ChartArea3DStyle areaStyle = new ChartArea3DStyle(chartArea);
    areaStyle.Rotation = 0;
    chart.ChartAreas.Add(chartArea);
    
    Axis yAxis = new Axis(chartArea, AxisName.Y);
    Axis xAxis = new Axis(chartArea, AxisName.X);
    
    // Bind the data to the chart
    chart.Series["Default"].Points.DataBindXY(xValues, yValues);
    
    // Add chart
    HtmlGenericControl li = new HtmlGenericControl("li");
    li.Controls.Add(chart);
    ul_Charts.Controls.Add(li);
    

    This example was found on the asp.net forums and was tweaked a little to fit your scenario. There are other options but this should at list give an idea of what you need to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to dynamically add javascript to an existing script element something like: var
I want to dynamically add links to my pages something like this: foreach (Node
I keep getting this error in the $('#savetickets-list') line. I want to dynamically add
I want to dynamically add triggers to a job, but can't find any helpful
I want to dynamically add some widgets like so: LinearLayout llay = new LinearLayout(this);
I want to dynamically add search box using Javascript to web-page like shown here
I have some code that dynamically add button to StackPanel. I want to do
I want to dynamically add threading.Thread classes to a thread queue based on a
I want to dynamically add .Select statements, but the compiler will only allow me
Suppose you want to dynamically add to a HTML menu, where the menu HTML

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.