H
Henry Nelson
Hi all
I'm very new to dotNet and just trying to get my head around the right way
to do the thing that I would normally do in asp.
In asp I would loop through a recordset and output all the html dynamically
for the layout I want. I have seen some examples of
using a repeater and they seem to be the thing to use when you don't want a
table of results, but I'm not sure how to change the
<ItemTemplate> depending on the contents of the data.
For example if I wish a list of html links and headings in asp I would do
the following:-
'--------------------------------------------------
Response.Write "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1>"
while not rs.eof
lngParent = CLng(rs("PARENT"))
lngEntity = CLng(rs("ENTITY"))
Response.Write "<TR>"
'##When the data in "PARENT" is 0 I want to display some text else I want
to output a blank cell then a link.
if lngParent = 0 then
Response.Write "<TH ALIGN=LEFT COLSPAN=2>" & trim(rs("PRODCODE")) &
"</TH>"
else
Response.Write "<TD width=20> </TD><TD class=lnk1><A class='red'
HREF=""javascript:menu(" & lngEntity & ");"">" & trim(rs("PRODCODE")) &
"</A></TD>"
end if
Response.Write "</TR>"
rs.movenext
wend
Response.Write "</TABLE>"
'--------------------------------------------------
The javascript function "menu" would set a hidden field and submit the form.
Could someone give me an example of a repeater
using an "<asp:LinkButton .." or another method that would give me the same
result of the above code.
Could anyone suggest some good tutorials for aspx/dotNet - the ones I've
found so far are:-
http://docs.learnasp.com/quickstart/aspplus/doc/quickstart.aspx
and
http://aspnet.4guysfromrolla.com/
cheers
Henry
I'm very new to dotNet and just trying to get my head around the right way
to do the thing that I would normally do in asp.
In asp I would loop through a recordset and output all the html dynamically
for the layout I want. I have seen some examples of
using a repeater and they seem to be the thing to use when you don't want a
table of results, but I'm not sure how to change the
<ItemTemplate> depending on the contents of the data.
For example if I wish a list of html links and headings in asp I would do
the following:-
'--------------------------------------------------
Response.Write "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1>"
while not rs.eof
lngParent = CLng(rs("PARENT"))
lngEntity = CLng(rs("ENTITY"))
Response.Write "<TR>"
'##When the data in "PARENT" is 0 I want to display some text else I want
to output a blank cell then a link.
if lngParent = 0 then
Response.Write "<TH ALIGN=LEFT COLSPAN=2>" & trim(rs("PRODCODE")) &
"</TH>"
else
Response.Write "<TD width=20> </TD><TD class=lnk1><A class='red'
HREF=""javascript:menu(" & lngEntity & ");"">" & trim(rs("PRODCODE")) &
"</A></TD>"
end if
Response.Write "</TR>"
rs.movenext
wend
Response.Write "</TABLE>"
'--------------------------------------------------
The javascript function "menu" would set a hidden field and submit the form.
Could someone give me an example of a repeater
using an "<asp:LinkButton .." or another method that would give me the same
result of the above code.
Could anyone suggest some good tutorials for aspx/dotNet - the ones I've
found so far are:-
http://docs.learnasp.com/quickstart/aspplus/doc/quickstart.aspx
and
http://aspnet.4guysfromrolla.com/
cheers
Henry