从GridView控件弹出图基于行的引用来显示数据 [英] Pop up chart from GridView to display data based on row reference

查看:207
本文介绍了从GridView控件弹出图基于行的引用来显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了凡弹出图表行上空盘旋图像时出现的GridView。

I have created a gridview where a pop up chart appears when hovering over an image in the row.

它的工作原理amaisingly很好,我曾经参与过的计算器解决方案已经(<一个href=\"http://stackoverflow.com/questions/19266983/popup-chart-in-vb-net-on-mouse-over/19277036#19277036\">Popup图表上鼠标 vb.net)

It works amaisingly well and I have posted the solution in stackoverflow already (Popup chart in vb.net on mouse over)

我现在的问题是,我想由集团列中过滤图表,但我无法弄清楚如何在名称值转移到SqlDataSource1查询。

My problem now is that I want the chart to be filtered by the 'Group' column, but I can't figure out how to transfer the 'name' value to the SqlDataSource1 query.

下面是在GridView样品code:

Here is the Gridview sample code:

    <asp:BoundField DataField="name" HeaderText="Group" SortExpression="name" />
    <asp:BoundField DataField="ASL" HeaderText="SL" ReadOnly="True" />
    <asp:TemplateField>
        <ItemTemplate>
            <div class="HoverDesc">
                <asp:Image ID="Image5" runat="server" Height="20px" src="Images/Icons/iGreen.png" />
                <p>
                    <asp:Chart ID="Chart2" runat="server" DataSourceID="SqlDataSource1" Height="141px">
                        <Series>
                            <asp:Series ChartType="Line" Name="Series1" XValueMember="date" YValueMembers="Value">
                            </asp:Series>
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="ChartArea1"></asp:ChartArea>
                        </ChartAreas>
                    </asp:Chart>
                </p>
            </div>
        </ItemTemplate>
    </asp:TemplateField>

任何想法将大大AP preciated。

Any ideas will be much appreciated.

感谢

推荐答案

我设法theresolve它。我得从以下站点的启示:<一href=\"http://social.msdn.microsoft.com/Forums/vstudio/en-US/bb0548cc-90f7-4622-8ced-61ded9a63b3d/chart-in-gridview?forum=MSWinWebChart\" rel=\"nofollow\">http://social.msdn.microsoft.com/Forums/vstudio/en-US/bb0548cc-90f7-4622-8ced-61ded9a63b3d/chart-in-gridview?forum=MSWinWebChart

I managed to theresolve it. I've got the inspiration from the following site: http://social.msdn.microsoft.com/Forums/vstudio/en-US/bb0548cc-90f7-4622-8ced-61ded9a63b3d/chart-in-gridview?forum=MSWinWebChart

如果它可以帮助别人,这里是我做过什么:

If it helps someone, here is what I did:

在ASP我加了一个OnRowDataBound在DataGrid和ItemTemplate模板里面一个SqlDataSource

In ASP I added a OnRowDataBound in the DataGrid and a SqlDataSource inside the ItemTemplate

OnRowDataBound="GridViewChart_RowDataBound"

在VB(如果你需要c您会发现它在上面的链接)code我添加以下

In the vb (if you need C you will find it in the link above) code I've added the following

Protected Sub GridViewChart_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
    If e.Row.RowType = DataControlRowType.DataRow Then

        Dim RG_name As String = Replace(e.Row.Cells(0).Text, "amp;", "")
        Dim SQL As SqlDataSource = DirectCast(e.Row.FindControl("SqlDataSource10"), SqlDataSource)
        SQL.SelectParameters("name").DefaultValue = RG_name

    End If
End Sub

这篇关于从GridView控件弹出图基于行的引用来显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆