Server-side events when selection changes?

3 posts, 0 answers
  1. Wayne
    Wayne avatar
    5 posts
    Member since:
    May 2016

    Posted 07 Jun Link to this post

    I have a rotator control that has a list of periods bound do it (think like a Category).  When I click the button to move to a new selection, I want a grid to update with the information for that period (e.g. grab the ID of the selected period, and query for it).  There doesn't seem to be a way to do this server-side though, only on the client.  Is my only recourse to use Ajax to pull the data and refresh the grid when something changes in the RadRotator?
  2. Wayne
    Wayne avatar
    5 posts
    Member since:
    May 2016

    Posted 07 Jun in reply to Wayne Link to this post

    Let me clarify I mean when the buttons to switch the visible item in the rotator is clicked, not the item inside (it's just a label).
  3. DevCraft R3 2016 release webinar banner
  4. Vessy
    Vessy avatar
    1350 posts

    Posted 10 Jun Link to this post

    Hi Wayne,

    If I understand your requirements properly you want to update the content of a Grid when the prev/next button of the Rotator is clicked. if so, I am afraid that the scrolling of the items of the Rotator is done on the client, thus you will need to initiate the update of the Grid client-side. A possible way to implement this is to assign a handler to the Rotator's ClientItemShown event and make an AJAX request from it.

    For example, you can use a similar logic:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
    <telerik:RadRotator ID="RadRotator1" runat="server" Width="300px" RotatorType="Buttons" ScrollDuration="500" OnClientItemShown="OnClientItemShown">
            <div class="RotatorItem" style="width: 300px">
                    <asp:Label ID="lblTitle" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "title") %>'></asp:Label></h2>
                    <asp:Label ID="lblShortDesc" Text='<%# DataBinder.Eval(Container.DataItem, "desc")%>' runat="server"></asp:Label>
    <telerik:RadGrid ID="RadGrid1" runat="server">
    <script type="text/javascript">
        function OnClientItemShown(sender, eventArgs) {
            //you can pass the clicked item index as an argument of ajaxRequest();
    protected void Page_Load(object sender, EventArgs e)
        RadRotator1.DataSource = GetData();
    private DataTable GetData()
        DataTable dt = new DataTable();
        dt.Columns.Add("title", typeof(string));
        dt.Columns.Add("desc", typeof(string));
        dt.Rows.Add("T0", "AAA");
        dt.Rows.Add("T1", "BBB");
        dt.Rows.Add("T2", "CCC");
        return dt;
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
       //your logic here
    index = e.Argument;
        RadGrid1.DataSource = new string[] { index, index, index, index, index, index, index };

    I hope this helps.

    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top