OnSeriesItemClicked Not Refreshing Datasource

7 posts, 0 answers
  1. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 01 Feb 2013 Link to this post

    Hi Everyone.

    VB.net AJAX Q2 2012.

    I have a line graph with several data points flowing left to right.  I used the OnCleintSeriesClicked Property and wrote:

    function Chart_Line_Count_SeriesClicked(sender,args)

    {

    if (args.get_seriesName() != "DaysL") $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(args.get_category());

    }

    Then through the RadAjaxManager1 configuration I associated the RadAjaxManager1 with the Chart_Line_Count Object.

    Then in the code behind file:

    Protected Sub RadAjaxManager1_AjaxRequest(sender As Object, e As AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest

      

    'test to clear datasource and blank out the chart

     Chart_Line_Count.DataSource = ""

     Chart_Line_Count.DataSourceID = ""

     

    End Sub

    But it doesn't work.  Can anyone tell me why?  I see the AJAX circular spinning refresh thing fire, but nothing happens.  Please let me know if you need any more information. 

  2. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 03 Feb 2013 Link to this post

    Here is some more information to better help.
    I also have a page load event that customizes the appearance of the chart.  Would that be conflicting with RadAjaxManager?  Can someone please help here?
    <telerik:RadHtmlChart ID="Chart_Line_Count" runat="server"
                DataSourceID="LINE_COUNT_YEAR" Height="230px" Width="915px"
                onclientseriesclicked="Chart_Line_Count_SeriesClicked">
                <ChartTitle Text="Line Count Trend">
                    <Appearance Align="Left" />
                </ChartTitle>
                <Legend>
                    <Appearance Visible="False" />
                </Legend>
                <PlotArea>
                    <Series>
                        <telerik:LineSeries DataFieldY="LINECOUNT" MissingValues="Gap" Name="YearsL">
                        </telerik:LineSeries>
                    </Series>
                </PlotArea>
            </telerik:RadHtmlChart>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 04 Feb 2013 Link to this post

    Hello Logan,

    We perform a check and if a null/Nothing datasource is passed the old one will remain in effect. You can avoid this by passing an empty array, so there will be no actual data to show, for example:
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Chart_Line_Count" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadCodeBlock runat="server" ID="rcb1">
        <script type="text/javascript">
            function Chart_Line_Count_SeriesClicked(sender, args)
            {
                if (args.get_seriesName() != "DaysL") $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(args.get_category());
            }
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadHtmlChart ID="Chart_Line_Count" runat="server" OnClientSeriesClicked="Chart_Line_Count_SeriesClicked">
        <PlotArea>
            <Series>
                <telerik:LineSeries Name="test series" DataFieldY="FirstColumn">
                </telerik:LineSeries>
            </Series>
        </PlotArea>
    </telerik:RadHtmlChart>
    Protected Sub RadAjaxManager1_AjaxRequest(sender As Object, e As AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
        Dim DS = New Integer() {}
        Chart_Line_Count.DataSource = DS
        Chart_Line_Count.DataBind()
    End Sub
     
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Chart_Line_Count.DataSource = GetData()
        Chart_Line_Count.DataBind()
    End Sub
     
    Protected Function GetData() As DataTable
        Dim tbl As New DataTable()
        tbl.Columns.Add(New DataColumn("FirstColumn"))
        tbl.Columns.Add(New DataColumn("SecondColumn"))
        tbl.Columns.Add(New DataColumn("ThirdColumn"))
        tbl.Columns.Add(New DataColumn("FourthColumn"))
        tbl.Rows.Add(New Object() {1, "firstRecord2", "firstRecord3", "firstRecord4"})
        tbl.Rows.Add(New Object() {2, "secondRecord2", "secondRecord3", "secondRecord4"})
        tbl.Rows.Add(New Object() {3, "thirdRecord2", "thirdRecord3", "thirdRecord4"})
        Return tbl
    End Function



    All the best,
    Marin Bratanov
    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.
  5. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 04 Feb 2013 Link to this post

    I am also using master pages.  Do I have to use the RadAjaxManagerProxy approach, is that optional for a master page scenario?
  6. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 04 Feb 2013 Link to this post

    Hi Telerik Support,

     

    So I tried what you mentioned and it didn't work for me, it had the same, spinning ajax loading panel with no change to the chart.

     

    Some more information that may help.

    I am using master pages, this chart is in a content pane, not on the master page.  Is a RadAjaxManagerProxy required?
    Also, I have a page load event that says:

    If Not Page.IsPostBack

    Then

    Load the charts with Data
    Else
    Format some elements of the chart
    Would this be conflicting with the asynchronous ajax post back?

    I tried your below code on a non master page and it worked fine.  Although when I just tried your:

    Protected Sub RadAjaxManager1_AjaxRequest(sender As Object, e As AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
        Dim DS = New Integer() {}
        Chart_Line_Count.DataSource = DS
        Chart_Line_Count.DataBind()

     

    On my page that references a master page, it didn't work.

    Any further ideas?  I thank you for your support.

     

     

  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 06 Feb 2013 Link to this post

    Hello Logan,

    Can you confirm the chart is actually updated on the client? You can see this by examining the response  in the network tab of your dev toolbar. If the chart wrapping element and its $create() statement are not present then your AJAX setings are incorrect and you need to fix them.

    Generally, RadAjaxManager should be on the master page and proxies on content pages/user controls, but if this will be your setup depends on your needs and the complexify of the pages. If, for example, the master page has only a menu and navigation and needs no AJAX functionality you could keep the maanger on each content page.

    I suggest you take a look at the following help article to see how you can use proxies with the manager's events: http://www.telerik.com/help/aspnet-ajax/ajax-ajaxmanagerproxy.html. You can also add a programmatic ajax setting in the master page to make sure the chart is updated: http://www.telerik.com/help/aspnet-ajax/ajax-add-ajaxsettings-programmatically.html.


    Greetings,
    Marin Bratanov
    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.
  8. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 06 Feb 2013 Link to this post

    Hi Marin,

    That solved it.  Putting RadAjaxManager on the Master page, the RadAjaxManagerProxy on the content page and adding a handler to the code behind file worked:

    Thank you for your help.
    Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
            AddHandler manager.AjaxRequest, AddressOf Manager_AjaxRequest
            manager.AjaxSettings.AddAjaxSetting(manager, Chart_Header_Count)
            manager.AjaxSettings.AddAjaxSetting(manager, Chart_Line_Count)
     
    'And then
     
    Protected Sub Manager_AjaxRequest(sender As Object, e As Telerik.Web.UI.AjaxRequestEventArgs)
    'Update chart data sources
    End sub
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017