This is a migrated thread and some comments may be shown as answers.

RadRotatorItem as sqldatasource control parameter

3 Answers 67 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Dusty
Top achievements
Rank 1
Dusty asked on 27 Oct 2015, 06:18 PM
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.

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 28 Oct 2015, 11:15 AM

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
0
Dusty
Top achievements
Rank 1
answered on 29 Oct 2015, 03:50 PM

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>

​

0
Marin Bratanov
Telerik team
answered on 30 Oct 2015, 09:35 AM

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
Tags
Rotator
Asked by
Dusty
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Dusty
Top achievements
Rank 1
Share this question
or