How can I do the below classic ASP in .NET '
- I have tried using a repeater, but can only get one long list, in my
ex. I need a list (contains 3 list)
TIA
Some data for the recordset...
--
groupID, item
1, item 1
1, item 2
1, item 3
2, item 4
2, item 5
3, item 6
--
<%
groupID = -1
do while not RS.EOF
if groupID <> RS("groupID") then
groupID = RS("groupID")
Response.Write(groupID)
end if
Response.Write(RS("item"))
RS.movenext
loop
%>Where is all the .Net experts in this group '
It can't be that complicated, pretty simple code. I really need some
help for the source-code below.
TIA
On Tue, 27 Jul 2004 12:02:41 GMT, author <none@.available.com> wrote:
> How can I do the below classic ASP in .NET '
> - I have tried using a repeater, but can only get one long list, in my
> ex. I need a list (contains 3 list)
> TIA
> --
> Some data for the recordset...
> --
> groupID, item
> 1, item 1
> 1, item 2
> 1, item 3
> 2, item 4
> 2, item 5
> 3, item 6
> --
>
> <%
> groupID = -1
> do while not RS.EOF
> if groupID <> RS("groupID") then
> groupID = RS("groupID")
> Response.Write(groupID)
> end if
> Response.Write(RS("item"))
> RS.movenext
> loop
> %>
Hi,
You might need to be a bit more explicit in your request.
1. Which .Net language do you want help porting it to?
2. Do you need help connecting to the database or just working with the
results?
Ross.
"author" <none@.available.com> wrote in message
news:4oveg0l3odjfpn9976t6vdk1jggpceib35@.
4ax.com...
> Where is all the .Net experts in this group '
> It can't be that complicated, pretty simple code. I really need some
> help for the source-code below.
> TIA
>
> On Tue, 27 Jul 2004 12:02:41 GMT, author <none@.available.com> wrote:
>
> 1. Which .Net language do you want help porting it to?
I dev. in VB.. but any language is fine.
> 2. Do you need help connecting to the database or just working with the
> results?
Just need help working with the results.
TIA
Well assuming that you have a DataTable containing your results (which you
may have filled from a SqlDataAdapter)
in C# (the VB.Net will be slightly different) the code might look like
(assuming I have not misunderstood your question).
DataTable table = ....
int groupId = -1;
foreach( DataRow row in table.Rows )
{
if ( (int)row["groupID"] != groupId )
{
groupId = (int)row["groupID"];
Response.Write( groupId );
}
Response.Write( (string)row["item"] );
}
HTH,
Ross.
"author" <none@.available.com> wrote in message
news:va8fg0p22vdrr2ukk83t0o73tdet4k5gvd@.
4ax.com...
> I dev. in VB.. but any language is fine.
>
> Just need help working with the results.
>
> TIA
>
> (assuming I have not misunderstood your question).
I don't know ;)
- but I will try to explain what I need, with some code (I know don't
work). I hope you understand the logic with this '
<asp:Repeater Id="groupList" RunAt="server">
<ItemTemplate>
<%
if Container.DataItem("groupID") <> groupID then
groupID = Container.DataItem("groupID")
%>
<tr>
<td colspan="2"><%# if Container.DataItem("groupID")%></td>
</tr>
<% end if %>
<tr>
<td><%# Container.DataItem("itemID")%></td>
<td><%# Container.DataItem("itemText")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment