Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to force Repeater control formatting <td width> and line bre

Reply
Thread Tools

How to force Repeater control formatting <td width> and line bre

 
 
JB
Guest
Posts: n/a
 
      10-23-2009
Hello

In my ASP.NET web application I am using the Repeater control. Placed
the Repeater in a Panel Control and included it in a table in order to make
data print one row on each line across the page, the datasource is a
DataTable and I am using css. I use a HeaderTemplate to create column
headings then I use ItemTemplate to show the data in the columns. The
problem is that the first row does use the width formatting that I
specified in the <td> tag and therefore prints under the column headings
the way that it should but the remaining rows in the table ignore the width
formatting that I specified in the <td> tag and just prints the rows using
its default setting which stops the rows data from continuing to print
under its corresponding column heading also none of the rows print on a
separate line so I inserted a <br /> tag to force a line break but I don't
think you are supposed to need to do that. So my questions are:

How do you make all rows in the table print using the width formatting
in the <td> tag and whether or not you must use <br /> to force line
breaking like I am doing?

Note: None of the examples that I have seen used <br /> but I know some
html so I used it to force the lines to break.

Below is the code:

<aspanel ID="pnlIncident" runat="server">
<asp:Repeater ID="rptIncident" runat="server">

<HeaderTemplate>
<table >
<tr>
<th align="left" width="40px">Prob#</th>
<th align="left" width="45px">Type</th>
<th align="left" width="40">p1</font></th>
<th align="left" width="45">p2</font></th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr>
<td align="left" width="40px" ><%#

DataBinder.Eval(Container.DataItem, "Prob#") %></td>
<td align="left" width="45px"> <%#

DataBinder.Eval(Container.DataItem, "Type") %></td>
<td align="left" width="40px" ><%#

DataBinder.Eval(Container.DataItem, "p1") %></td>
<td align="left" width="45px"> <%#

DataBinder.Eval(Container.DataItem, "p2") %></td>
</tr>
<br />

</table>
</ItemTemplate>

</asp:Repeater>
</aspanel>

JB
--
JB
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      10-24-2009
On Oct 23, 11:29*pm, JB <(E-Mail Removed)> wrote:
> Hello
>
> * * In my ASP.NET web application I am using the Repeater control. Placed
> the Repeater in a Panel Control and included it in a table in order to make
> data print one row on each line across the page, the datasource is a
> DataTable and I am using css. *I use a HeaderTemplate to create column
> headings then I use ItemTemplate to show the data in the columns. *The
> problem is that the first row does use the width formatting that I
> specified in the <td> tag and therefore prints under the column headings
> the way that it should but the remaining rows in the table ignore the width
> formatting that I specified in the <td> tag and just prints the rows using
> its default setting which stops the rows data from continuing to print
> under its corresponding column heading also none of the rows print on a
> separate line so I inserted a <br /> tag to force a line break but I don't
> think you are supposed to need to do that. *So my questions are:
>
> * * How do you *make all rows in the table print using the width formatting
> in the <td> tag and whether or not you must use <br /> to force line
> breaking like I am doing?
>
> Note: None of the examples that I have seen used <br /> but I know some
> html so I used it to force the lines to break.
>
> Below is the code:
>
> * * <aspanel ID="pnlIncident" runat="server">
> * * <asp:Repeater ID="rptIncident" runat="server">
>
> * * <HeaderTemplate>
> * * <table >
> * * * * <tr>
> * * * * * * <th align="left" width="40px">Prob#</th>
> * * * * * * <th align="left" width="45px">Type</th>
> * * * * * * <th align="left" width="40">p1</font></th>
> * * * * * * <th align="left" width="45">p2</font></th>
> * * * * </tr>
> * * </HeaderTemplate>
>
> * * <ItemTemplate>
> * * * * <tr>
> * * * * * * <td align="left" width="40px" ><%#
>
> DataBinder.Eval(Container.DataItem, "Prob#") %></td>
> * * * * * * <td align="left" width="45px"> <%#
>
> DataBinder.Eval(Container.DataItem, "Type") %></td>
> * * * * * * <td align="left" width="40px" ><%#
>
> DataBinder.Eval(Container.DataItem, "p1") %></td>
> * * * * * * <td align="left" width="45px"> <%#
>
> DataBinder.Eval(Container.DataItem, "p2") %></td>
> * * * * *</tr>
> * * * * *<br />
>
> * * </table>
> * * </ItemTemplate>
>
> * * </asp:Repeater>
> * * </aspanel>
>
> * * JB
> --
> JB


Try to use style="widthx" instead of width attribute. I think, you
don't need to repeat it for TD cells and you can use style only for
TH. Note, that

<th align="left" width="40">p1</font></th>
<th align="left" width="45">p2</font></th>

has </font> in the cells...

I don't get what does <br /> in your code, but this would definitely
cause validation error
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
Nike Air Force Ones,Air Force One Air Force One-1 lky52193@gmail.com Computer Support 0 01-17-2008 04:40 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:46 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:34 PM



Advertisments