Answered by:
Repeater Control

Question
-
User1487175000 posted
Hi.
I need to use the repeater in my website where basically i want to shows the equipments by grouping
so group name will be shown in the header and then its item listing under it
and then new header with new group name and new item listing under it.
here is my sql query and its result. plz any one can help me how i configure the repeater or any other contorl in asp.net so i that i can show the data and retrive the data in code behind file.
SQL Query
select u.ID,U.Benamning,u.Pris, g.Benamning as grupp
from RumBokUtrustning u Left join RumBokUtrustningGrupp g
on g.Id = u.UtrustningGruppId
where VisasIBokning = 1
order by g.rank, u.benamningand here is query result
ID Benamning Pris grupp
81 Rolf debitering 0 Ofta använda art
53 Konferens - intern 0 Övrigt
45 Övrigt B 0 Övrigt
52 Övrigt B 0 Övrigt
57 Provision 0 Övrigt
69 Scendel 250 Övrigt
70 Dessert 0 Mat
46 Frukost 0 Mat
13 Frukt- & choklad min.5 pers 50 Mat
8 Kaffe och bulle 85 Mat
15 Kaffe och småkakaor 55 Mat
14 Kaffe och smörgås 89 Mat
9 Lunch 230 Mat
33 Måltidspaket 430 Mat
40 Middag 0 Mat
66 Muffins 29 Mat
72 Smörgås 69 Mat
71 Smörgås matig 85 Mat
49 Snacks 15 Mat
60 Snittar 0 Mat
12 Fresh water 70 cl 40 Dryck
68 Juice 25 Dryck
5 Kaffe 25 Dryck
6 Läsk/softdrinks 25 Dryck
41 Sprit 17 Dryck
42 Starköl 45 Dryck
65 Te 25 Dryck
82 Test 0 Dryck
38 Vin 0 Dryck
39 Vin 0 Dryck
10 Dator 300 Teknik
43 Hyra teknik 0 Teknik
11 Konferenstelefon 395 Teknik
1 Overhead 100 Teknik
3 Projektor 0 Teknik
59 TV 375 Teknik
31 Videokonferens 6900 Teknik
73 Grupprum 1 Rum
44 Kvällstaxa 750 Rum
80 Logi 0 Rum
62 Morgontaxa 750 Rum
37 IT-tjänster internt 0 Kontorshotellet
64 Secretarial services 0 KontorshotelletHere is image what i want to show. One very import thing i want to add Checkbox in the repeater but its not bound to any field in the table its just use for selection
<a href="http://www.freeimagehosting.net/7d20a"><img src="http://www.freeimagehosting.net/t/7d20a.jpg"></a>
Monday, November 14, 2011 11:00 AM
Answers
-
User3866881 posted
Hello:)
For Groupped GridView or something related to this, I'm afraid you should refer to:
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, November 16, 2011 8:10 PM
All replies
-
User-2010311731 posted
Here are some good tutorials for this...
http://www.asp.net/data-access/tutorials/displaying-data-with-the-datalist-and-repeater
Matt
Monday, November 14, 2011 11:13 AM -
User3866881 posted
Hello:)
According to what you say, you should use your Repeater control like this following:
<asp:Repeater Id="rep" runat="server">
<HeaderTemplate>
<table>
<tr>
<th>ID</th>
<th>Benamning</th>
<th>Pris</th>
<th>grupp</th>
</tr>
</HeaderTemplate><ItemTemplate>
<tr>
<td><asp:CheckBox id="chkbox" runat="server"/></td>
<td><%#Eval("ID")%></td>
<td><%#Eval("Benamning")</td>
<td><%#Eval("Pris")</td>
<td><%#Eval("grupp")</td>
</tr></ItemTemplate>
</asp:Repeater>
Then in the code-behind, you can do this:
protected void Page_Load(object sender,EventArgs e)
{
if(!IsPostBack)
{
Rep.DataSource = xxx;
Rep.DataBind();
}
}Tuesday, November 15, 2011 8:41 PM -
User1487175000 posted
Decker thanks Yes i know i can bind my data with the repeater like this. But i did not want to show the group field with each row. what i want items related to same group shows together and groupp name shows as heading and items related to that group shows under the header for example
Technical [This is groupp field treat as heading]
Projector
computer
voip phone
video conferencing
food & drinks [this is groupp field treat as heading]
wine
coffe
salid
soft drink
and so on.
what you suggest me
Wednesday, November 16, 2011 6:50 PM -
User3866881 posted
Hello:)
For Groupped GridView or something related to this, I'm afraid you should refer to:
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, November 16, 2011 8:10 PM