图表信息取决于每个数据网格行

发布于 2024-11-09 05:43:33 字数 1735 浏览 0 评论 0原文

我想在数据网格的每一行上都有一个图表,因为图表源信息是图表插入的行的信息。

到目前为止,这是我所得到的:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="idCampaign" DataSourceID="SqlDataSource1" >
   <Columns>
      <asp:BoundField DataField="idPerson" HeaderText="idPerson" Visible="false"
                    InsertVisible="False" ReadOnly="True" SortExpression="idPerson" />
      <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
      <asp:BoundField DataField="age" HeaderText="age" SortExpression="age" />   
      <asp:TemplateField>
         <ItemTemplate>
            <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource2">
               <Series>
                  <asp:Series Name="Series1" XValueMember="name" 
                                    YValueMembers="age"></asp:Series>
                  </Series>
                  <ChartAreas>
                     <asp:ChartArea Name="ChartArea1"></asp:ChartArea>
                  </ChartAreas>
            </asp:Chart>
              <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:outboundsmsConnectionString %>"
                            SelectCommand="SELECT idPerson, name, age FROM Person WHERE (idPerson = **currentRowPersonId**)">
                        </asp:SqlDataSource>
                    </ItemTemplate>
                </asp:TemplateField>
                           </Columns>
        </asp:GridView>

我在这方面遇到了一些麻烦,并且不知道如何获得粗体部分......

有什么帮助吗?

I want to have a chart on each row of a data grid, being that the chart source information is information o the row the chart is inserted into.

Here's what I've got so far:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="idCampaign" DataSourceID="SqlDataSource1" >
   <Columns>
      <asp:BoundField DataField="idPerson" HeaderText="idPerson" Visible="false"
                    InsertVisible="False" ReadOnly="True" SortExpression="idPerson" />
      <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
      <asp:BoundField DataField="age" HeaderText="age" SortExpression="age" />   
      <asp:TemplateField>
         <ItemTemplate>
            <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource2">
               <Series>
                  <asp:Series Name="Series1" XValueMember="name" 
                                    YValueMembers="age"></asp:Series>
                  </Series>
                  <ChartAreas>
                     <asp:ChartArea Name="ChartArea1"></asp:ChartArea>
                  </ChartAreas>
            </asp:Chart>
              <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:outboundsmsConnectionString %>"
                            SelectCommand="SELECT idPerson, name, age FROM Person WHERE (idPerson = **currentRowPersonId**)">
                        </asp:SqlDataSource>
                    </ItemTemplate>
                </asp:TemplateField>
                           </Columns>
        </asp:GridView>

I'm having quite some trouble with this and don't know how to get the bold part...

Any help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

影子的影子 2024-11-16 05:43:33

查德的建议奏效了,但有一点不同:

SelectCommand='<%# Eval("idPerson", "SELECT idPerson, name, age FROM Person WHERE (idPerson = {0}") %>)'

谢谢!

Chad's sugestion worked but with a little twist:

SelectCommand='<%# Eval("idPerson", "SELECT idPerson, name, age FROM Person WHERE (idPerson = {0}") %>)'

Thanks!

海风掠过北极光 2024-11-16 05:43:33
SelectCommand='SELECT idPerson, name, age FROM Person WHERE (idPerson = <%# Eval("idPerson") %>)'
SelectCommand='SELECT idPerson, name, age FROM Person WHERE (idPerson = <%# Eval("idPerson") %>)'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文