|
-
Sep 10th, 2004, 02:08 PM
#1
Thread Starter
New Member
Embed For Loop
I'd like to loop though and display a given amount of images
Code:
<table>
<tr>
<%
dim x as integer
for x = 1 to 5
%>
<td><asp:Image ImageUrl='readrealimage.aspx?id=1' Width="84" Height="105" Runat=server />
</td>
<%
next
%>
</tr>
</table>
But instead of my id variable in the URL being 1, I need it to be the value of x from my loop?
Can someone help me out?
-
Sep 13th, 2004, 04:20 AM
#2
Addicted Member
have you considered the repeater control or a db bound grid. Else you need to send out your html via something like response.write - there is also host of built in commands for contructing the elements of html in code.
-
Sep 22nd, 2004, 11:09 PM
#3
Member
I hate to ask, but why are you trying to use the Image control? It will slow down the processing on your page considerably because the server has to render the page twice for its control layout. A more resource-friendly approach would be to use something similar to the following:
Code:
<table>
<tr>
<%
Dim x As Integer
For x = 1 To 5
%>
<td><img src="readrealimage.aspx?id=<%= x %>" style="width: 84px; height: 105px;"></td>
<% Next %>
</tr>
</table>
T
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|