473,387 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Formatting Repeater oontrol output

We have been using a repeater to spit out images to a page and our seperator
is simply a non-breaking space. This is the style we need because it adjusts
nicely for the users resolution and width of their browser window. Heres the
basic code

<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<img src="<%=ServerTag Goes Here%>">
</ItemTemplate>
<SeparatorTemplate>

</SeparatorTemplate>
</asp:Repeater>

Now, our requirement has changed to require a caption be displayed
immediately below the image, but we still want the same basic layout. In
other words if the browser window is wide and gets resized narrower, the
images and captions 'drop down' to still fit within the window, and vice
versa.

I have tried two basic approaches to this. The first puts a table inside
the item template that holds both the image and the caption as in the
following:

<asp:Repeater with attributes here>
<ItemTemplate>
<table>
<tr>
<td>
<img src="<%=ServerTag Goes Here%>">
<br>
<%# DataBinder.Eval(Container, "DataItem.Caption")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>

The second approach uses the code above without the table structure: just
image and a break and the caption. Both approaches create output that is
essentially one-column. Additionally, we cannot use the ItemTemplate with
AlternatingItemTemplate to produce the output because two-column output, for
us, is really no better than one-column output. It nees to be 'dynamic' to
the browser window size and resolution.

I am hoping that someone can provide an HTML trick for the html in the
ItemTemplate. Or, perhaps there is some attibute or setting that I am not
seeing. I considered the DatGrid and the DataList. The grid is out because
it by definition is columns and rows, right. The DataList has the
RepeatLayout = Flow (versus table) but I messed with that for quite some time
and couldnt get it to work right either.

Any help appreciated,

David

Nov 19 '05 #1
1 2803
After much experimentation, we determined that by wrapping the
image,break,and caption in a span tag with the float attribute set to
left, we ALMOST got the exact formatting we wanted. With the previous
technique the images aligned in a row along their bottom, since all
images are different sizes it looks slightly better than aligning them
at the top of each row.

Regards,
David T

Pitcairnia wrote:
We have been using a repeater to spit out images to a page and our seperator is simply a non-breaking space. This is the style we need because it adjusts nicely for the users resolution and width of their browser window. Heres the basic code

<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<img src="<%=ServerTag Goes Here%>">
</ItemTemplate>
<SeparatorTemplate>

</SeparatorTemplate>
</asp:Repeater>

Now, our requirement has changed to require a caption be displayed
immediately below the image, but we still want the same basic layout. In other words if the browser window is wide and gets resized narrower, the images and captions 'drop down' to still fit within the window, and vice versa.

I have tried two basic approaches to this. The first puts a table inside the item template that holds both the image and the caption as in the following:

<asp:Repeater with attributes here>
<ItemTemplate>
<table>
<tr>
<td>
<img src="<%=ServerTag Goes Here%>">
<br>
<%# DataBinder.Eval(Container, "DataItem.Caption")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>

The second approach uses the code above without the table structure: just image and a break and the caption. Both approaches create output that is essentially one-column. Additionally, we cannot use the ItemTemplate with AlternatingItemTemplate to produce the output because two-column output, for us, is really no better than one-column output. It nees to be 'dynamic' to the browser window size and resolution.

I am hoping that someone can provide an HTML trick for the html in the ItemTemplate. Or, perhaps there is some attibute or setting that I am not seeing. I considered the DatGrid and the DataList. The grid is out because it by definition is columns and rows, right. The DataList has the
RepeatLayout = Flow (versus table) but I messed with that for quite some time and couldnt get it to work right either.

Any help appreciated,

David


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Joe | last post by:
Hey, Can anyone out there see why when this code renders there's a 1px space between the headertemplate and the itemtemplate. <asp:datalist id="asplistDL" BorderStyle="None"...
1
by: Henry Nelson | last post by:
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...
1
by: Bijoy Naick | last post by:
I have a query that spits out a single column of text rows. For example, City "London" "New York" "Toronto" "Chicago" I have a repeater that I'd like to use to spit out the output as...
5
by: Wayne Wengert | last post by:
I have a bound repeater control on my ASP page and am having a problem figuring out how to format the output for two different fields. The Subroutine I am trying to create is listed below. The...
1
by: D. Shane Fowlkes | last post by:
Hey guys. I have a Repeater and a Template. One of the dataitems calls a helper function. The dataitem sends the record ID to the function and the function runs a complex query and returns a...
0
by: tenaka2k | last post by:
OK I have poked around and have not found an answer to my problem . I have a repeater that in it's <ItemTemplate> calls a function I want to pass the current values from the repeater to the...
1
by: Alex Maghen | last post by:
I'm taking text from a multi-line TextBox into a database. Then, on other pages, I'm displaying that text as read-only. But the problem is, when I set the Text property of a Label control to that...
3
by: Emma Middlebrook | last post by:
Hi there, I've been trying to implement a repeater control in an ASP.NET 2 page but I can't seem to get the layout exactly how I want and I'm not sure if it's something that I am doing wrong or...
12
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.