RadRotatorItem as sqldatasource control parameter

4 posts, 0 answers
  1. Dusty
    Dusty avatar
    7 posts
    Member since:
    Jan 2015

    Posted 27 Oct 2015 Link to this post

    Is there a way to set a value in the RadRotatorItem that can be used as an asp control parameter in a SqlDataSource?  I have a RadRotator with a client item shown event that I want to fire a repaint of RadHTMLCharts on a page when the Rotator hit's the next item.  I want to be able to specify the value passed to the control parameter.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 28 Oct 2015 Link to this post

    Hello,

    I think the easiest approach would be to store that info in a span or a hidden span in the rotator item so you can retrieve it.

    Then, in the ItemShown event, you can put it in a hidden field or textbox so you can use it for the server. request.

    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dusty
    Dusty avatar
    7 posts
    Member since:
    Jan 2015

    Posted 29 Oct 2015 in reply to Marin Bratanov Link to this post

    Thanks - I tried using a similar method but I think I'm unfamiliar with the repaint method of a RadHtmlChart and it rebinding from the datasource attached to it.  Through the rotator, i'm trying to update a control that is a control parameter of the datasource of the chart, but on repaint, nothing seems to happen.

     

    <telerik:RadRotator ID="RadRotator1" runat="server" Width="1200px" ItemWidth="150"
                            Height="250px" ItemHeight="188" ScrollDuration="500" FrameDuration="5000" PauseOnMouseOver="false" RotatorType="Carousel" OnClientItemShown="OnClientItemShown">
                            <Items>
                                <telerik:RadRotatorItem ID="rr648">
                                    <ItemTemplate>
                                        <asp:Image ID="Image1" runat="server" ImageUrl="~/Img/Employees/Aaron_g.jpg" />
                                    </ItemTemplate>
                                </telerik:RadRotatorItem>
                                <telerik:RadRotatorItem ID="rr762">
                                    <ItemTemplate>
                                        <asp:Image ID="Image2" runat="server" ImageUrl="~/Img/Employees/Travis_p.jpg" />
                                    </ItemTemplate>
                                </telerik:RadRotatorItem>
                                <telerik:RadRotatorItem ID="rr764">
                                    <ItemTemplate>
                                        <asp:Image ID="Image3" runat="server" ImageUrl="~/Img/Employees/Frank_j.jpg" />
                                    </ItemTemplate>
                                </telerik:RadRotatorItem>
                                <telerik:RadRotatorItem ID="rr769">
                                    <ItemTemplate>
                                        <asp:Image ID="Image4" runat="server" ImageUrl="~/Img/Employees/Mark_k.jpg" />
                                    </ItemTemplate>
                                </telerik:RadRotatorItem>
                                <telerik:RadRotatorItem ID="rr770">
                                    <ItemTemplate>
                                        <asp:Image ID="Image5" runat="server" ImageUrl="~/Img/Employees/Kevin_dawe.jpg" />
                                    </ItemTemplate>
                                </telerik:RadRotatorItem>
                            </Items>
                        </telerik:RadRotator>

    <telerik:RadHtmlChart ID="rchContractFunnel" runat="server" DataSourceID="sdsContractBreakdown" Height="210px" Width="500px" Skin="Silk">
                                <PlotArea>
                                    <Series>
                                        <telerik:FunnelSeries DynamicHeightEnabled="false" DynamicSlopeEnabled="false" SegmentSpacing="0" NeckRatio="0.3" DataFieldY="Total" DataNameField="name">
                                        </telerik:FunnelSeries>
                                    </Series>
                                </PlotArea>

                                <Legend>
                                    <Appearance Visible="true"></Appearance>
                                </Legend>
                                <ChartTitle Text="Week To Date"></ChartTitle>

                            </telerik:RadHtmlChart>

    <asp:SqlDataSource ID="sdsContractBreakdown" ConnectionString="<%$ ConnectionStrings:CMICDATAConn %>"
                    SelectCommand="asp_GetSalesDashboardData_ContractFunnel" SelectCommandType="StoredProcedure" runat="server">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="rrTeam" DefaultValue="648" Name="EmpID" PropertyName="Text" />
                        <asp:ControlParameter ControlID="rblDateRange" DefaultValue="1" Name="DateTypeID" PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>

    <asp:Label ID="rrTeam" runat="server" Text="" style="visibility:hidden;"></asp:Label>

    <telerik:RadScriptBlock runat="server" ID="rcb1">
                <script type="text/javascript">
                    function OnClientItemShown(sender, args) {

                        var rotatorItem = args.get_item();
                        var itemElem = rotatorItem.get_element();
                        var wrapper = itemElem.firstChild;
                        var ds = $find("<%=sdsContractBreakdown.ClientID %>");

                        if (wrapper.id == "RadRotator1_i0") {
                            var rrTeam = document.getElementById("rrTeam").innerHTML;
                            var team = "648";
                            rrTeam = team;
                        }
                        if (wrapper.id == "RadRotator1_i1") {
                            var rrTeam = document.getElementById("rrTeam").innerHTML;
                            var team = "762";
                            rrTeam = team;
                        }
                        if (wrapper.id == "RadRotator1_i2") {
                            var rrTeam = document.getElementById("rrTeam").innerHTML;
                            var team = "764";
                            rrTeam = team;
                        }
                        if (wrapper.id == "RadRotator1_i3") {
                            var rrTeam = document.getElementById("rrTeam").innerHTML;
                            var team = "769";
                            rrTeam = team;
                        }
                        if (wrapper.id == "RadRotator1_i4") {
                            var rrTeam = document.getElementById("rrTeam").innerHTML;
                            var team = "770";
                            rrTeam = team;
                        }

                        setTimeout(function () {
                            var funnel = $find("<%=rchContractFunnel.ClientID %>");
                            funnel.set_dataSource(ds);
                            funnel.set_transitions(true);
                            funnel.repaint();
                        }, 1000);
                        
                    }

                </script>
            </telerik:RadScriptBlock>

  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 30 Oct 2015 Link to this post

    Hello,

    The repaint() method of RadHtmlChart only redraws its client-side rendering. It will not request new data because the control does not have a built-in facility for invoking postbacks.

    I can suggest two approaches to your case:

    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top