How to bind data to graphs in asp.net mvc3http://forums.asp.net/t/1799998.aspx/1?How+to+bind+data+to+graphs+in+asp+net+mvc3Fri, 04 May 2012 08:33:17 -040017999984964990http://forums.asp.net/p/1799998/4964990.aspx/1?How+to+bind+data+to+graphs+in+asp+net+mvc3How to bind data to graphs in asp.net mvc3 <p>Hi to All,</p> <p>&nbsp; &nbsp;I Want to bind my products table data to graph from sql server database</p> <p>but I got the error as &quot;Specified Method is Not Suported&quot;,</p> <p>below is my code,</p> <p>public class Default1Controller : Controller<br> {<br> private DummyEntities db = new DummyEntities();<br> // GET: /Default1/</p> <p>public ActionResult Index()<br> {<br> var b = db.Products;<br> var chart = new Chart(width: 400, height: 200, theme: ChartTheme.Blue)<br> .AddTitle(&quot;Products&quot;)<br> .AddSeries(chartType: &quot;pie&quot;)<br> .DataBindTable(dataSource: b, xField: &quot;ProductName&quot;);<br> <br> this.ViewBag.Chart = chart; <br> return View();<br> <br> <br> }</p> <p>view:</p> <p>&lt;%@ Page Title=&quot;&quot; Language=&quot;C#&quot; MasterPageFile=&quot;~/Views/Shared/Site.Master&quot; Inherits=&quot;System.Web.Mvc.ViewPage&lt;MvcApplication17.Product&gt;&quot; %&gt;</p> <p>&lt;asp:Content ID=&quot;Content1&quot; ContentPlaceHolderID=&quot;TitleContent&quot; runat=&quot;server&quot;&gt;<br> Index<br> &lt;/asp:Content&gt;</p> <p>&lt;asp:Content ID=&quot;Content2&quot; ContentPlaceHolderID=&quot;MainContent&quot; runat=&quot;server&quot;&gt;<br> &lt;%:ViewBag.Chart.Write() %&gt;<br> &lt;h2&gt;Index&lt;/h2&gt;</p> <p>&lt;/asp:Content&gt;</p> <p>If anyone know the solution please send&nbsp;</p> 2012-05-04T07:13:48-04:004965012http://forums.asp.net/p/1799998/4965012.aspx/1?Re+How+to+bind+data+to+graphs+in+asp+net+mvc3Re: How to bind data to graphs in asp.net mvc3 <p></p> <blockquote><span class="icon-blockquote"></span> <h4>chandana G</h4> I got the error as &quot;Specified Method is Not Suported&quot;,</blockquote> <p></p> <p>I think that this is the line:</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>chandana G</h4> &lt;%:ViewBag.Chart.Write() %&gt;</blockquote> <p></p> <p>Why not put just </p> <p>&lt;%:ViewBag.Chart %&gt;</p> 2012-05-04T07:21:27-04:004965018http://forums.asp.net/p/1799998/4965018.aspx/1?Re+How+to+bind+data+to+graphs+in+asp+net+mvc3Re: How to bind data to graphs in asp.net mvc3 <p>try this</p> <pre class="default prettyprint" style=""><code style="border-width:0px; margin:0px; padding:0px; font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif; font-size:14px; vertical-align:baseline; background-color:#eeeeee"><span class="lit" style="border-width:0px; margin:0px; padding:0px; color:#800000; font-size:14px; vertical-align:baseline; background-color:transparent">@ViewBag</span><span class="pun" style="border-width:0px; margin:0px; padding:0px; color:#000000; font-size:14px; vertical-align:baseline; background-color:transparent">.</span><span class="typ" style="border-width:0px; margin:0px; padding:0px; color:#2b91af; font-size:14px; vertical-align:baseline; background-color:transparent">Chart</span><span class="pun" style="border-width:0px; margin:0px; padding:0px; color:#000000; font-size:14px; vertical-align:baseline; background-color:transparent">.</span><span class="typ" style="border-width:0px; margin:0px; padding:0px; color:#2b91af; font-size:14px; vertical-align:baseline; background-color:transparent">Write</span><span class="pun" style="border-width:0px; margin:0px; padding:0px; color:#000000; font-size:14px; vertical-align:baseline; background-color:transparent">()</span></code></pre> 2012-05-04T07:24:33-04:004965030http://forums.asp.net/p/1799998/4965030.aspx/1?Re+How+to+bind+data+to+graphs+in+asp+net+mvc3Re: How to bind data to graphs in asp.net mvc3 <p>Hi,</p> <p>could you please refer this link, maybe can solve your problem</p> <p>http://msdn.microsoft.com/en-us/library/dd489231.aspx</p> <p></p> <p></p> 2012-05-04T07:28:08-04:004965172http://forums.asp.net/p/1799998/4965172.aspx/1?Re+How+to+bind+data+to+graphs+in+asp+net+mvc3Re: How to bind data to graphs in asp.net mvc3 <p>but output as&nbsp;</p> <p>System.Web.Helpers.Chart only,</p> <p>nothing is displayed on the screen</p> 2012-05-04T08:33:17-04:00