college_amy
Regular
- Joined
- Jan 3, 2004
- Messages
- 83
I am using a repeater and a dataset to retrieve / display data from a database.
The data consists of a few fields one of which being a Type field that contains either a 0 or a 1 depending on the type of data in the record.
I want, with only the one trip to the db, to extract all the records. Which I did. But after the records are retrieved, I want to sort them based on type and only certain rows be displayed in a certain format with the repeater.
For example:
<asp:repeater>
<itemtemplate>
<tr <%databinder stuff type == 1%>>
<td>Type 1 Name:<%databinder stuff name%> *only those names with type=1 display here </td>
</tr>
<tr <%databinder stuff type == 0%>>
<td>Type 0 Name: <%databinder stuff name %> *only those names with type=0 display here </td>
</tr>
</itemtemplate>
</asp:repeater>
The condition is where I am having the problem. Because the data is arranged in such a way, I am having difficulty displaying the data with conditions. I only want the names of a certain person to show in the first row if their type == 1. Like wise for the second row I only want them to show the names of the people whos types are 0.
I know there is a bunch of stuff missing from the above example but I do have it all there in the code. I hope you understand and know a solution for this without making numerous trips to the db and without having multiple repeaters.
Any help is appreciated.
The data consists of a few fields one of which being a Type field that contains either a 0 or a 1 depending on the type of data in the record.
I want, with only the one trip to the db, to extract all the records. Which I did. But after the records are retrieved, I want to sort them based on type and only certain rows be displayed in a certain format with the repeater.
For example:
<asp:repeater>
<itemtemplate>
<tr <%databinder stuff type == 1%>>
<td>Type 1 Name:<%databinder stuff name%> *only those names with type=1 display here </td>
</tr>
<tr <%databinder stuff type == 0%>>
<td>Type 0 Name: <%databinder stuff name %> *only those names with type=0 display here </td>
</tr>
</itemtemplate>
</asp:repeater>
The condition is where I am having the problem. Because the data is arranged in such a way, I am having difficulty displaying the data with conditions. I only want the names of a certain person to show in the first row if their type == 1. Like wise for the second row I only want them to show the names of the people whos types are 0.
I know there is a bunch of stuff missing from the above example but I do have it all there in the code. I hope you understand and know a solution for this without making numerous trips to the db and without having multiple repeaters.
Any help is appreciated.