图表信息取决于每个数据网格行
我想在数据网格的每一行上都有一个图表,因为图表源信息是图表插入的行的信息。
到目前为止,这是我所得到的:
<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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查德的建议奏效了,但有一点不同:
谢谢!
Chad's sugestion worked but with a little twist:
Thanks!