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 675337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:48:25+00:00 2026-05-14T00:48:25+00:00

I have a problem when i using Mschart on my MVC project, when i

  • 0

I have a problem when i using Mschart on my MVC project, when i use the first index page of project to render for the partial view name index2 the code is

<% Html.RenderPartial("Index2"); %>

But when i run it the error is occur which the message is

CS0029: Cannot implicitly convert type ‘ASP.views_home_index2_ascx’ to ‘System.Web.UI.Page’

-it said that the problem line of code is

: // Render chart control

Line 52: Chart2.Page = this; << At here

Line 53: HtmlTextWriter writer = new
HtmlTextWriter(Page.Response.Output);

Line 54: Chart2.RenderControl(writer);

But when i put all of code in Index2.ascx to the index.aspx and not to render the partial view it work fine

Code of Index2.ascx is

 <%   
            System.Web.UI.DataVisualization.Charting.Chart Chart2 = new System.Web.UI.DataVisualization.Charting.Chart();
            Chart2.Width = 412;
            Chart2.Height = 296;
            Chart2.RenderType = RenderType.ImageTag;

            Chart2.Palette = ChartColorPalette.BrightPastel;
            Title t = new Title("No Code Behind Page", Docking.Top, new System.Drawing.Font("Trebuchet MS", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105));
            Chart2.Titles.Add(t);
            Chart2.ChartAreas.Add("Series 1");

            Chart2.Series.Add("Series 1");

            // add points to series 1
            Chart2.Series["Series 1"].Points.AddY(3);
            Chart2.Series["Series 1"].Points.AddY(4);
            Chart2.Series["Series 1"].Points.AddY(5);

            Chart2.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;
            Chart2.BorderColor = System.Drawing.Color.FromArgb(26, 59, 105);
            Chart2.BorderlineDashStyle = ChartDashStyle.Solid;
            Chart2.BorderWidth = 2;

            Chart2.Legends.Add("Legend1");

            // Render chart control
            Chart2.Page = this;
            HtmlTextWriter writer = new HtmlTextWriter(Page.Response.Output);
            Chart2.RenderControl(writer);

%>

  • 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-14T00:48:26+00:00Added an answer on May 14, 2026 at 12:48 am

    The error does seem to suggest that it is required to be within an ASP.NET page, probably because with the changes to the MVC architecture and how the views don’t really use the page/control collection.

    To simplify this process, you could create an HTML helper method that does most of that work for you in a reusable way. Also, you could try using a and just embed the control within the page too as an alternative. If you want to do the helper route, you can do:

    public static class ChartExtensions
    {
       public static string Chart(this HtmlHelper html, <settings>)
       {
         //Put code here, return a string
       }
    }
    

    HTH.

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

Sidebar

Ask A Question

Stats

  • Questions 378k
  • Answers 378k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think you are rather looking for a possibility to… May 14, 2026 at 9:08 pm
  • Editorial Team
    Editorial Team added an answer A void function doesn't return anything, so there's nothing to… May 14, 2026 at 9:08 pm
  • Editorial Team
    Editorial Team added an answer If your key has the maximum length of 8 bytes… May 14, 2026 at 9:08 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.