高级图表在母版页中不可见。 [英] High charts are not visible in master page.

查看:80
本文介绍了高级图表在母版页中不可见。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在主页文件的.aspx页面中使用高图表。

如果我在普通的aspx页面中执行我的代码然后它工作正常但是如果我在aspx上添加相同的代码带有母版页参考的页面图表不可见。

任何人都可以帮我解决这个问题。



以下是我的代码:

I am try to use high chart in .aspx page which is with Masterpage file.
If i execute my code in normal aspx page then it works fine but if i add the same code on aspx page with master page references the charts are not visible.
Can any one help me regarding this issue.

Following is my Code:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ComplaintAgeing_Pie.aspx.cs" Inherits="ComplaintAgeing_Pie" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>
<%@ Register Assembly="Highchart" Namespace="Highchart.UI" TagPrefix="highchart" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script src="js/1.7.2jquery.min.js"></script><script src="js/TweenLite.min.js"></script><script src="js/TweenMax.min.js"></script>
<div>
<table>
<tr>
<td>
 <highchart:linechart id="hcTemperatura" width="100" height="100"  runat="server" />
</td>
</tr>
</table>

</div>







--------- -------------------------------------------------- -----------------------------

CS代码背后的代码。






----------------------------------------------------------------------------------------
Code behind CS code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections.ObjectModel;
using Highchart.Core.Data.Chart;
using Highchart.Core;
using Highchart;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections;

public partial class ComplaintAgeing_Pie : System.Web.UI.Page
{
    private GENERIC gn = new GENERIC();
    //DataSet dsSeries = new DataSet();
    ArrayList hidValues11 = new ArrayList();
    ArrayList hidXCategories11 = new ArrayList();
    object[] yValues;
    public object hidValues1;
    public string hidXCategories1;


protected void btnGenerate_Click(object sender, EventArgs e)
{

    
        try
        {
            if (ddlPlant.SelectedIndex == 0)
            {
                Showmessage("Select Plant!");
                return;
            }

            if (txtDtFrom.Text == "" || txtDtTo.Text == "")
            {
                Showmessage("Select Form Date To Date!");
                return;
            }

            if (getDate(txtDtFrom.Text) > getDate(txtDtTo.Text))
            {
                Showmessage("Start date Should be less than End Date!");
                return;
            }
            if (ddlProductSeg.SelectedIndex == 0)
            {
                Showmessage("Select Product Segment!");
                return;
            }
            FillComplaintGrid();


        }
        
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
        }
    
}


    private void FillComplaintGrid()
    {
        try
        {

            
            # region grid

            DataTable dt = new DataTable();
            DateTime date1 = getDate(txtDtFrom.Text);
            DateTime date2 = getDate(txtDtTo.Text);

            int month = ((date2.Year - date1.Year) * 12) + date2.Month - date1.Month + 1;
            DateTime date3 = new DateTime();
            date3 = date1.AddMonths(-1);

            dt.Columns.Add(new DataColumn("Title", typeof(string)));
            dt.Columns.Add(new DataColumn("No. of Complaints", typeof(string)));
            dt.Columns.Add(new DataColumn("PerComplaints", typeof(string)));
   

            string[,] paramVal = new string[4, 2];
            paramVal[0, 0] = "@CR_ProductSegCode";
            paramVal[0, 1] = ddlProductSeg.SelectedValue;
            paramVal[1, 0] = "@CR_PlantCode_int";
            paramVal[1, 1] = ddlPlant.SelectedValue;
            paramVal[2, 0] = "@StDate";
            paramVal[2, 1] = date1.ToString();
            paramVal[3, 0] = "@EndDate";
            paramVal[3, 1] = date2.ToString();
         
            DataSet ds = gn.fillGrid_with_param_DAL("ComplaintAgeing_Pie", paramVal);
          



            if(ds.Tables[0].Rows.Count>0)
            {
                DataRow dr = dt.NewRow();
                int totalOpenComp = Convert.ToInt32(ds.Tables[0].Rows[0]["AllOpen"]);
                
                //double percentOfComp = ((totalOpenComp / Convert.ToInt32(ds.Tables[0].Rows[0]["LessThan15Open"])) * 100);
                dr["Title"] = "Less Than 15 Days";
                dr["No. of Complaints"] = ds.Tables[0].Rows[0]["LessThan15Open"];
                dr["PerComplaints"] = 10;
                dt.Rows.InsertAt(dr, dt.Rows.Count + 1);

                DataRow dr1 = dt.NewRow();
                //double percentOfCompG15 = ((totalOpenComp / Convert.ToInt32(ds.Tables[0].Rows[0]["between16TO30Open"])) * 100);
                dr1["Title"] = "16 to 30 Days";
                dr1["No. of Complaints"] = ds.Tables[0].Rows[0]["between16TO30Open"];
                dr1["PerComplaints"] = 20;
                dt.Rows.InsertAt(dr1, dt.Rows.Count + 1);

                DataRow dr2 = dt.NewRow();
               // double percentOfComp1 = ((totalOpenComp / Convert.ToInt32(ds.Tables[0].Rows[0]["between30to40Open"])) * 100);
                dr2["Title"] = "31 to 45 Days";
                dr2["No. of Complaints"] = ds.Tables[0].Rows[0]["between30to40Open"];
                dr2["PerComplaints"] = 10;
                dt.Rows.InsertAt(dr2, dt.Rows.Count + 1);

                DataRow dr3 = dt.NewRow();
                //double percentOfComp2 = ((totalOpenComp / Convert.ToInt32(ds.Tables[0].Rows[0]["Morethan45Open"])) * 100);
                dr3["Title"] = "More Than 45 Days";
                dr3["No. of Complaints"] = ds.Tables[0].Rows[0]["Morethan45Open"];
                dr3["PerComplaints"] = 50;
                dt.Rows.InsertAt(dr3, dt.Rows.Count + 1);

                DataRow dr5 = dt.NewRow();
                dr5["Title"] = "Closed";
                dr5["No. of Complaints"] = ds.Tables[0].Rows[0]["AllClosed"];
                dr5["PerComplaints"] = 10;
                dt.Rows.InsertAt(dr5, dt.Rows.Count + 1);

                 DataRow dr4 = dt.NewRow();
                dr4["Title"] = "Total";
                dr4["No. of Complaints"] = ds.Tables[0].Rows[0]["totCount"];
                dr4["PerComplaints"] = 0;
                dt.Rows.InsertAt(dr4, dt.Rows.Count + 1);
            }
            ViewState["dsSeries"] = dt;
            grd_FFBRTrack.DataSource = dt;
            grd_FFBRTrack.DataBind();
            Exemplo03();

            #endregion
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
        }

    }

    private void Exemplo03()
    {
        DataTable dsSeries = (DataTable)ViewState["dsSeries"];

        if (dsSeries == null) return;

        foreach (DataRow dr in dsSeries.Rows)
        {
            hidXCategories11.Add(dr["Title"]);


        }

        foreach (DataRow dr1 in dsSeries.Rows)
        {
            hidValues11.Add(Convert.ToInt32(dr1["PerComplaints"]));
            yValues = hidValues11.ToArray(typeof(object)) as object[];
            //hidValues1 = hidValues1 + dr1["value"].ToString();

        }

        hcTemperatura.YAxis.Add(new YAxisItem { title = new Title("Kw/hora") });
        hcTemperatura.XAxis.Add(new XAxisItem { categories = hidXCategories11.ToArray(typeof(string)) as string[] });

        //dados
        var series = new Collection<serie>();
        series.Add(new Serie { name = "Estimated", data = yValues });
        hcTemperatura.Tooltip = new ToolTip("this.x +': '+ this.y");

      
        hcTemperatura.Legend = new Legend
        {
            layout = Layout.vertical,
            borderWidth = 3,
            align = Align.right,
            y = 20,
            x = -20,
            verticalAlign = Highchart.Core.VerticalAlign.top,
            shadow = true,
            backgroundColor = "#000000"
        };

        //bind do controle
        hcTemperatura.DataSource = series;
        hcTemperatura.DataBind();
    }


}</serie>

推荐答案

你写的你的代码在btnGenerate_Click事件中。但是你的母版页中没有按钮可以触发此事件。



希望秀点击按钮调用此事件。
You have written your code in btnGenerate_Click event. But there is not button in your master page to fire this event.

Hope show call this event in a button click.


这篇关于高级图表在母版页中不可见。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆