No or empty series when using masterpage scenario

Thread is closed for posting
3 posts, 0 answers
  1. Peter
    Peter avatar
    4 posts
    Member since:
    Jun 2012

    Posted 19 Jul 2012 Link to this post

    Hi all,

    My problem is this: when I move a working radChart to a master/content page scenario the chart shows me the message 'there is no or empty series'. The same code works ok when I place it in a regular aspx page. I tried adding the RadScriptManager to the masterpage but that didn't work. I went through this forum and found a lot of posts on the masterpage problem but no solution to my problem, unfortunately. Here is the code

    aspx page

    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/masterpages/ControlHolder.master" CodeBehind="test2.aspx.cs" Inherits="TestLme2" %> 
    <%@ MasterType virtualpath="~/masterpages/ControlHolder.Master" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Charting" tagprefix="telerik" %>
     
    <asp:Content ID="ContentMain" ContentPlaceHolderID="cntControl" Runat="Server">
          
    <telerik:RadChart ID="radChart1" runat="server" Width="700px" AutoLayout="True" 
            Skin="Default2006">
                  
            <Series>
    <telerik:ChartSeries Name="Series 1">
        <Appearance>
            <FillStyle MainColor="150, 150, 150" SecondColor="194, 194, 194">
            </FillStyle>
            <Border Color="Silver" />
        </Appearance>
                </telerik:ChartSeries>
    <telerik:ChartSeries Name="Series 2">
        <Appearance>
            <FillStyle MainColor="215, 215, 214" SecondColor="241, 241, 241">
            </FillStyle>
            <Border Color="Silver" />
        </Appearance>
                </telerik:ChartSeries>
    </Series>
            <PlotArea>
                <XAxis>
                    <Appearance Color="Silver" MajorTick-Color="Silver">
                        <MajorGridLines Color="Silver" />
                    </Appearance>
                </XAxis>
                <YAxis>
                    <Appearance Color="Silver" MajorTick-Color="Silver" 
                        MinorTick-Color="Silver">
                        <MajorGridLines Color="Silver" />
                        <MinorGridLines Color="224, 224, 224" />
                    </Appearance>
                </YAxis>
                <Appearance Dimensions-Margins="18%, 22%, 12%, 10%">
                    <FillStyle MainColor="White" SecondColor="White" FillType="Solid">
                    </FillStyle>
                    <Border Color="Silver" />
                </Appearance>
            </PlotArea>
            <Appearance>
                <FillStyle MainColor="WhiteSmoke">
                </FillStyle>
                <Border Color="Silver" />
            </Appearance>
            <ChartTitle>
                <Appearance Position-AlignedPosition="Top">
                </Appearance>
                <TextBlock>
                    <Appearance TextProperties-Color="Gray">
                    </Appearance>
                </TextBlock>
            </ChartTitle>
            <Legend>
                <Appearance Dimensions-Margins="18%, 1%, 1px, 1px">
                    <Border Color="Silver" />
                </Appearance>
            </Legend>
                  
            </telerik:RadChart>
            <br />
            <br />
      
        </asp:Content>

    and the aspx.cs page:

    protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
      
                    DataTable tbl = new DataTable();
                    DataColumn col = new DataColumn("Value");
                    col.DataType = typeof(int);
                    tbl.Columns.Add(col);
                    col = new DataColumn("Date");
                    col.DataType = typeof(double);
                    tbl.Columns.Add(col);
      
                    tbl.Rows.Add(new object[] { 5, DateTime.Today.ToOADate() });
                    tbl.Rows.Add(new object[] { 4, DateTime.Today.AddDays(1).ToOADate() });
                    tbl.Rows.Add(new object[] { 3, DateTime.Today.AddDays(2).ToOADate() });
                    tbl.Rows.Add(new object[] { 6, DateTime.Today.AddDays(3).ToOADate() });
                    tbl.Rows.Add(new object[] { 3, DateTime.Today.AddDays(4).ToOADate() });
                    tbl.Rows.Add(new object[] { 6, DateTime.Today.AddDays(5).ToOADate() });
      
                    ChartSeries ser = new ChartSeries("Value");
                    ser.DataYColumn = "Value";
                    ser.DataXColumn = "Date";
                    radChart1.Series.Add(ser);
      
                    radChart1.PlotArea.XAxis.IsZeroBased = false;
                    radChart1.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.ShortDate;
      
                    radChart1.DataSource = tbl;
                    radChart1.DataBind();
                }
            }

    Anyone have any ideas why this is happening?

    Thanks,

    Peter

  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 20 Jul 2012 Link to this post

    Hi Peter,

    Thanks for the attached code, I was able to create a new project based on it.

    When I run the project I do see a chart displayed properly. I have attached a snapshot of the output and also attached the project for you to check out. The chart resides in Default.aspx. Is this the master/content page scenario that you are talking about? Do run the app and see if you get the same results.

    If you need further assistance you can prepare a small project that reproduces this undesired behavior and open a new support ticket and attach this project, so that we can look for solutions.

    Regards,
    Petar Marchev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Peter avatar
    4 posts
    Member since:
    Jun 2012

    Posted 20 Jul 2012 Link to this post

    Hi Petar,

    Thanks for your reply. Comparing the two projects put me in the right direction. My project has a PageLoad in the aspx page itself and that overrides the PageLoad in codebehind where the series were created. Hence no series available. Moving the chart and code to a user control solved the problem.

    Thanks again,

    Peter

Back to Top