How can I get the x-axis label when bound to a database

Thread is closed for posting
6 posts, 0 answers
  1. Eric
    Eric avatar
    48 posts
    Member since:
    Jul 2012

    Posted 13 Jun 2011 Link to this post

    Hello,

    I have a radchart which is bound to a database.  When I click on a piece of the bar chart, I want to drill down to another chart based on the label of the piece they clicked.  For instance, if I have a bar chart with the number sold of apples/oranges on it, when I click on the apples colomn, I want to show another chart about apples.  How can I determine what the label is from the click method.  The args.seriesItem.name is "Item2", so that doesn't help.  Also, args.seriesItem.label.base.TextBlock.text is empty.

    Thanks,

    Eric
  2. Eric
    Eric avatar
    48 posts
    Member since:
    Jul 2012

    Posted 13 Jun 2011 Link to this post

    So I found out how to do it, although its not very clean:

     

     

    string

     

     

    name = args.Series.PlotArea.XAxis.Items[args.SeriesItem.Index].TextBlock.Text;


    Eric

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 16 Jun 2011 Link to this post

    Hi Eric,

    You may also find our Drill Down demo useful for your scenario.

    Greetings,
    Evgenia
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Eric
    Eric avatar
    48 posts
    Member since:
    Jul 2012

    Posted 16 Jun 2011 Link to this post

    Year = args.SeriesItem.Index + 2003;
    SqlDataSource2.SelectParameters[0].DefaultValue = Year.ToString();

    ...

    int quarter = args.SeriesItem.Index + 1;
    SqlDataSource3.SelectParameters[0].DefaultValue = Year.ToString();
    SqlDataSource3.SelectParameters[1].DefaultValue = quarter.ToString();

    ....
    lol, thats even more of a hack than I came up with. If the year, quarter, and month weren't all numbers, that wouldn't work at all. Also, you seem to already know that the year is going start at 2003. What if that was variable?

    Eric
  6. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 22 Jun 2011 Link to this post

    Hi Eric,

    Indeed the Drill-Down demo has hardcoded XValues. However you can set the Year to the MinValue of the XAxis if you want.

    Greetings,
    Evgenia
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Rusty
    Rusty avatar
    14 posts
    Member since:
    Oct 2011

    Posted 14 Feb 2012 Link to this post

    I am trying to do the same thing. Did you ever find a better way?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017