Click to See Complete Forum and Search --> : Need to repeat a lot of <a></a> tags in HTML code, dynamically.


Takhir
July 23rd, 2006, 08:37 PM
I have a huge collection of JPEG files, it contains different themes. Each theme looks like a set of JPEG files, from tens to hundreds. The HTML of each page, reproducing these files as small images, looks like a repeated <a>...</a> code, smth like this:

<td><A href="/images/A/01.JPG"><IMG id="im_04" src="/images/A/01.JPG"></A></td>
<td><A href="/images/A/02.JPG"><IMG id="im_03" src="/images/A/02.JPG"></A></td>
....

I need to provide a ASP.NET code (in C#) for these lines, that should looks like a cycle, which writes in HTML the incremented <a>..</a> tags. I don't want to do it manually in HTML, I know the number of JPEG files to be represented, so I know the number of cycle iterations in C# code.
How can I do it?

P.S. Probably, in HTML in will not look like an amount of <a></a> tags.

Shuja Ali
July 24th, 2006, 02:26 AM
You can use Response.Write in a loop to add the hrefs or you can even dynamically create the HyperLink controls.

It should be easy enough I guess.

Takhir
July 24th, 2006, 09:24 AM
But how can I determine the place (in the table <- code), where can I use Write.Response? Ie if I write it in a PageLoad method, it will write it on the very top. But I have a table with cells, and the loop should be placed in a definite cell. How can I determine that cell from C# code?

Alsvha
July 24th, 2006, 12:51 PM
You do that by programming the place the lines should be printed. Place literals/lables - or simply access the table cells and print out in the table, or make the entier table in your code-behind using various techniques. There are a ton of ways to do this.

Sorry if it doesn't sound helpful, but what you are asking is rather basic programming techniques, and it does seem as if you haven't done any programming before. If that is the case, then I'd suggest you read up programming using either online tutorials to learn the techniques or (real) books if you prefere.

I doubt anybody here can help you with this, withouth making the entier code for you, lest you have specific questions :)