Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeater Position Question

Status
Not open for further replies.

trinzul

IS-IT--Management
Feb 16, 2004
13
US
I'm having trouble getting a repeater in the exact position i want on my web form. When i add the repeater to the form it defaults it to the top left corner, and i am unable to move it to any other point on the form. I would think it is possible to specify it in the HTML, but nothing i've tried seems to work. Below is a sample of the repeater code i've written. If any one has any suggestions they would be greatly appriciated.



<asp:repeater id="Repeater1" runat="server">
<HeaderTemplate>
<table>
<tr>
<td bgcolor="#cccc99" width="200"><b>Provider Name</b></td>
<td bgcolor="#cccc99" width="200"><b>Address1</b></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem,"facility_name") %>
&nbsp;
</td>
<td>
<p>
<%# DataBinder.Eval(Container.DataItem,"address_1") %>
</p>
<p>
<%# DataBinder.Eval(Container.DataItem,"address_2") %>
</p>
<%# DataBinder.Eval(Container.DataItem,"city") %>
<%# DataBinder.Eval(Container.DataItem,"state") %>
<%# DataBinder.Eval(Container.DataItem,"zip") %>
<%# DataBinder.Eval(Container.DataItem,"phone") %>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr>
<td bgcolor="#cccc99">
<%# DataBinder.Eval(Container.DataItem,"facility_name") %>
&nbsp;
</td>
<td bgcolor="#cccc99">
<%# DataBinder.Eval(Container.DataItem,"address_1") %>
<%# DataBinder.Eval(Container.DataItem,"address_2") %>
<%# DataBinder.Eval(Container.DataItem,"city") %>
<%# DataBinder.Eval(Container.DataItem,"state") %>
<%# DataBinder.Eval(Container.DataItem,"zip") %>
<%# DataBinder.Eval(Container.DataItem,"phone") %>
</td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:repeater></form>
 
trin: You can use an Absolute positioning statement, or place the Repeater inside an HTML table cell, setting the cell's alignment properties, or use division tags (<div align="center"></div>).
 
change the layout setting on your aspx page from flow to grid. this will give you exact positioning (although it doesn't follow css standards really well).
 
bb: doing this in Visual Studio did not add the exact position (absolute position) of the repeater - for some reason, which is the problem trinz probably ran into.

If you add a textbox, dropdownlist, DataGrid and other objects in flow layout, in the HTML you get:

<asp:Textbox id="txtA" runat="server" width="150px"/>

..and then when you switch (page properties) from "flow" to "grid" these objects take on the absolute positioning params, q.v.,

<asp:Textbox id="txtA" runat="server" width="150px" style="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 256px"/>

..however, for some reason, the repeater doesn't behave this way, and you get the following for either "flow" or "grid", q.v.,

<asp:Repeater id="Repeater1" runat="server" />

..but if you add the absolute positioning style elements manually using a cut and paste, the repeater behaves accordingly (as expected).

<asp:Repeater id="Repeater1" runat="server" style="Z-INDEX: 102; LEFT: 40px; POSITION: absolute; TOP: 256px"></asp:Repeater>

So, not a clue as to why this occurs but think that is what tinz ran into.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top