按数据源的列对数据进行分组,并通过转发器将其显示在单独的表中 [英] Group data by column from data source and display it in separate tables by repeater

查看:44
本文介绍了按数据源的列对数据进行分组,并通过转发器将其显示在单独的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的桌子是这样的:

Tournament_Group:

Hi,
I have a table something like this:
Tournament_Group:

(Group_Name: A, Team_Name: Team1, Ranking: 1, Points: 9, Sets: 9:1, Score: 187:100)
(Group_Name: A, Team_Name: Team1, Ranking: 1, Points: 9, Sets: 9:1, Score: 187:115)
(Group_Name: A, Team_Name: Team2, Ranking: 2, Points: 5, Sets: 6:4, Score: 152:120)
(Group_Name: A, Team_Name: Team3, Ranking: 3, Points: 3, Sets: 3:7, Score: 100:145)
(Group_Name: A, Team_Name: Team4, Ranking: 4, Points: 1, Sets: 2:8, Score: 92:180)
(Group_Name: B, Team_Name: Team5, Ranking: 1, Points: 12, Sets: 10:0, Score: 199:100)
(Group_Name: B, Team_Name: Team6, Ranking: 2, Points: 4, Sets: 5:5, Score: 152:148)
(Group_Name: B, Team_Name: Team7, Ranking: 3, Points: 3, Sets: 2:8, Score: 87:155)
(Group_Name: B, Team_Name: Team8, Ranking: 4, Points: 1, Sets: 1:9, Score: 83:180)





我选择一个数据源,因为我想显示全部来自锦标赛的组,其主键在QueryString(@ Round,@ Of_our_ID)中指定。但我想通过Repeater在不同的表(A组和B组)中显示组。我想将转发器用于将有两个以上组或仅一个组的情况。我不能用PHP做到这一点。 :-(



这是我选择的数据源:



I select this by one data source, because I want to display all the groups from the Tournament, whose primary key is specified in the QueryString (@Round, @Tour_ID). But I want to display the groups in separate tables (Group A and Group B) by Repeater. I want to use repeater for case that there will be more than two groups or only one group. And I can not do it in PHP. :-(

Here is my select for datasource:

SELECT DISTINCT ros.Basic_Group_Name, reg.Ranking_in_the_Group, ros.Name, reg.Points_in_the_Group, reg.Sets_Won + ':' + reg.Sets_Lost AS 'Sets', reg.Score_Plus + ':' + reg.Score_Minus AS 'Score'
FROM Tournament_Reg AS reg INNER JOIN Roster AS ros ON reg.Roster_ID = ros.ID
WHERE (reg.Tournament_Round = @Round) AND (reg.Tour_ID = @Tour_ID) ORDER BY ros.Group_Name, reg.Ranking





我想显示如下内容:





I want to display something like this:

<h2> Group A </h2>
A  Team1  1  9  9:1  187:115
A  Team2  2  5  6:4  152:120
A  Team3  3  3  3:7  100:145
A  Team4  4  1  2:8  92:180

<h2> Group B </h2>
B  Team5  1  12 10:0 199:100
B  Team6  2  4  5:5  152:148
B  Team7  3  3  2:8  87:155
B  Team8  4  1  1:9  83:180)





我需要使用嵌套以某种方式转发器,但我不知道如何在嵌套转发器中调用指定组的选择。在dataSource中,我无法设置参数@Group_Name,因为我想要更多的值,我无法从转发器中定义的标题(h2)到达标签。

请有人帮助我,请?



非常感谢你!

Pepin z Hane



I need to use nested repeaters somehow, but I do not know how to call a select for the specified group in nested repeater. In dataSource I can not set the parameter @Group_Name, because I want more values for it and I can not reach the label from the title (h2) defined in the repeater.
Would anybody help me, please?

Thank you a lot!
Pepin z Hane

推荐答案

看看这里:

如何使用嵌套的Repeater控件和Visual C#.NET显示分层数据 [ ^ ]

在ASP.NET中使用嵌套转发器的快速指南 [ ^ ]



我希望它可以提供帮助。
Have a look here:
How To Display Hierarchical Data by Using Nested Repeater Controls and Visual C# .NET[^]
A quick guide to using nested repeaters in ASP.NET[^]

I hope it might help.


这篇关于按数据源的列对数据进行分组,并通过转发器将其显示在单独的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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