Click here to Skip to main content
15,891,567 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Obfuscated script (likely malware) Pin
DragonHeart33525-Feb-14 3:56
DragonHeart33525-Feb-14 3:56 
GeneralRe: Obfuscated script (likely malware) Pin
jkirkerx1-Mar-14 18:00
professionaljkirkerx1-Mar-14 18:00 
GeneralRe: Obfuscated script (likely malware) Pin
Bernhard Hiller2-Mar-14 20:15
Bernhard Hiller2-Mar-14 20:15 
QuestionStore form page in csv format Pin
abmanish7122-Feb-14 2:30
abmanish7122-Feb-14 2:30 
AnswerRe: Store form page in csv format Pin
Abhishek_RK2-Mar-14 20:51
Abhishek_RK2-Mar-14 20:51 
QuestionGoogle Chart error Pin
miss78620-Feb-14 6:13
miss78620-Feb-14 6:13 
AnswerRe: Google Chart error Pin
Richard Deeming20-Feb-14 8:36
mveRichard Deeming20-Feb-14 8:36 
GeneralRe: Google Chart error Pin
miss78624-Feb-14 6:15
miss78624-Feb-14 6:15 
Hi,

I am calling drawVisualization Function from the code behind:

default.aspx.cs

<pre lang="c#"> protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
         
            
           JavaScriptSerializer jss = new JavaScriptSerializer();

           ClientScript.RegisterStartupScript(this.GetType(), "TestInitPageScript",
               string.Format("<script type=\"text/javascript\">drawVisualization({0},'{1}','{2}');</script>",
               jss.Serialize(GetData()),
                "Text Example",
                "Name,type,"));

        }
    }

    [WebMethod]
    public static List<Data> GetData()
    {
        SqlConnection conn = new SqlConnection("Data Source=84.18.208.130;Initial Catalog=cdw;Persist Security Info=True;User ID=cdwadmin;Password=remote8313");                                                                                                  
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        conn.Open();
        string cmdstr = "select top 100 Name, [Decimal price],Cover from [dbo].[database_BWICs]";
        SqlCommand cmd = new SqlCommand(cmdstr, conn);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        adp.Fill(ds);
        dt = ds.Tables[0];
        List<Data> dataList = new List<Data>();
        string cat="";
        float val=0;
        string typ = "";
        
        foreach (DataRow dr in dt.Rows)
        {
            try
            {
                cat = dr[0].ToString();

                val = Convert.ToInt32(dr[1]);

                typ = dr[2].ToString();

            }
            catch
            {
            }
            dataList.Add(new Data(cat, val, typ));
        }
        return dataList;
    }


my Default.aspx code is pretty much the same, besides the following line has been updated:
new google.visualization.Dashboard(document.getElementById('PieChartExample')).bind([categoryPicker],[pie]).draw(data);

I have also added google.load line of code as suggested but that has made no difference, as I am still experiencing the same error.
I have tired to re-write my behind code but I am not sure, if my approach is incorrect or something else?

I really appreciate your time and help.
Many Thanks.
GeneralRe: Google Chart error Pin
Richard Deeming24-Feb-14 8:47
mveRichard Deeming24-Feb-14 8:47 
GeneralRe: Google Chart error Pin
miss78628-Feb-14 0:39
miss78628-Feb-14 0:39 
GeneralRe: Google Chart error Pin
Richard Deeming28-Feb-14 1:11
mveRichard Deeming28-Feb-14 1:11 
GeneralRe: Google Chart error Pin
miss7867-Mar-14 3:52
miss7867-Mar-14 3:52 
Questiondatetime can't be change other format? Pin
pkarthionline17-Feb-14 2:11
pkarthionline17-Feb-14 2:11 
SuggestionRe: datetime can't be change other format? Pin
Richard MacCutchan17-Feb-14 2:43
mveRichard MacCutchan17-Feb-14 2:43 
Questionabout window app Pin
Member 1057338416-Feb-14 0:50
Member 1057338416-Feb-14 0:50 
AnswerRe: about window app Pin
Richard MacCutchan16-Feb-14 1:20
mveRichard MacCutchan16-Feb-14 1:20 
QuestionWant to add radio button and append the value in CSV file Pin
abmanish7115-Feb-14 19:10
abmanish7115-Feb-14 19:10 
AnswerRe: Want to add radio button and append the value in CSV file Pin
Kornfeld Eliyahu Peter15-Feb-14 20:33
professionalKornfeld Eliyahu Peter15-Feb-14 20:33 
Questionretrieve and display image from SQL server in html Pin
Member 1057920214-Feb-14 11:18
Member 1057920214-Feb-14 11:18 
AnswerRe: retrieve and display image from SQL server in html Pin
Richard Deeming17-Feb-14 2:04
mveRichard Deeming17-Feb-14 2:04 
GeneralRe: retrieve and display image from SQL server in html Pin
Member 1057920218-Feb-14 7:46
Member 1057920218-Feb-14 7:46 
GeneralRe: retrieve and display image from SQL server in html Pin
Richard Deeming18-Feb-14 8:04
mveRichard Deeming18-Feb-14 8:04 
GeneralRe: retrieve and display image from SQL server in html Pin
Member 1057920218-Feb-14 8:09
Member 1057920218-Feb-14 8:09 
GeneralRe: retrieve and display image from SQL server in html Pin
Richard Deeming18-Feb-14 8:14
mveRichard Deeming18-Feb-14 8:14 
GeneralRe: retrieve and display image from SQL server in html Pin
Member 1057920218-Feb-14 8:41
Member 1057920218-Feb-14 8:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.