Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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)


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:
SQL
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:

HTML
<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)


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
Posted
Updated 30-Dec-13 10:08am
v2
Comments
Maciej Los 30-Dec-13 16:07pm    
--posted by mistake--
Maciej Los 30-Dec-13 16:16pm    
Sorry, posted by mistake.
Pepin z Hane 30-Dec-13 16:15pm    
There is no problem in SQL, there is a problem in asp.NET web forms. In asp.NET web forms, You can not write something to HTML page in cycle like in PHP. Only the way how to fix it, is using Repeater, but the question is how!? For one repeater you have only one DataSource, no matter if you fill it with Linq or SQL Command.

1 solution

 
Share this answer
 
Comments
Pepin z Hane 30-Dec-13 17:33pm    
Nope, I have found something similar to my problem and they set as a parameter for the sql command a control from parrent repeater. As I have written I can not select a label from the title h2. But I have tried it if it works for they, but it does not work for me. It throws an error: "In Class ControlParameter Group_Name was not found control member lblGroupName." I do not know if I have translated correctly, but I think so.
Maciej Los 31-Dec-13 2:04am    
Without seeing your code, i can't help you. Generally the reason of your trouble is bad control binding. Have a look at links above.
Pepin z Hane 31-Dec-13 5:58am    
Here is the code: http://www.codeproject.com/Questions/704001/Nested-repeater-which-has-different-Data-Source-do
Thanks for helping!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900