Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
var Drugresult = objdb.FetchCommonDrugGraphOnSearch(fromdate, todate);
            if (Drugresult.Count > 0)
            {
                StrDrug.Append(@"<script type=text/javascript> google.load( *visualization*, *1*, {packages:[*corechart*]});
                          google.setOnLoadCallback(drawChart);
                          function drawChart() {
                          var data = new google.visualization.DataTable();
                          data.addColumn('string', 'DrugName');
                          data.addColumn('number', 'Drug');
                          data.addRows(" + Drugresult.Count + ");");
                Int32 i;
                for (i = 0; i <= Drugresult.Count - 1; i++)
                {
                    StrDrug.Append("data.setValue( " + i + "," + 0 + "," + "'" + Drugresult[i].DrugName + "');");
                    StrDrug.Append("data.setValue(" + i + "," + 1 + "," + Drugresult[i].TotalCount.ToString() + ") ;");
                }
                StrDrug.Append("var chart = new google.visualization.BarChart(document.getElementById('DivDrug'));");
                StrDrug.Append("chart.draw(data, {width: 400, height: 300, title: 'No of Drug',");
                StrDrug.Append("vAxis: {title: 'Drug', titleTextStyle: {color: 'green'}},");
                StrDrug.Append("hAxis: {title: 'Drug Name', titleTextStyle: {color: 'green'}}");
                StrDrug.Append("});");
                //StrDrug.Append(" google.visualization.events.addListener(chart, 'select', function() {var selection = chart.getSelection();var row = selection[0].row; var col = selection[0].column;var year = data.getValue(row, 0);location.href ='../Report.ascx?date=' + year +'&type=1';});");
                StrDrug.Append("}");
                StrDrug.Append("</script>");
                LiteralDrug.Text = StrDrug.ToString().TrimEnd(',').Replace('*', '"');
            }
Posted

1 solution

call the function within ScriptManager.RegisterClientScriptBlock

http://asp-arka.blogspot.in/2014/05/how-to-show-alert-box-within-updatepanel.html[^]
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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