Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have controller from which i want to show chart view in page

C#
public ActionResult Index()
        {
            int y = 100;
            int x = 100;
            DataTable dt = ChDb.FSelectVendor();
            IEnumerable<vendor> emp;
            emp = (from DataRow row in dt.Rows
                   select new Vendor
                   {
                       id = Convert.ToInt32(row["VeId"].ToString())                       
                   }).ToList();
            Chart chart = new Chart(200, 200).AddTitle("Cool graph").AddSeries(chartType:"pie").DataBindTable(dataSource: emp,xField:"VendorId");
            this.ViewBag.Chart = chart;

            return View();
        }
Class Vendor
{
  public int id{get;set;}
  
}

in View Page
i have used
@ViewBag.Chart.Write()

it doesnot display the chat and throwing the exception lik Vendor is of type int,string,long,decimal
Posted
Updated 8-Aug-12 1:41am
v3

 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900