RE: A question about Repeater control



Hi Vincent,

Welcome to the ASPNET newsgroup.

>From your description, you're using the ASP.NET repeater control to display 
list of hyperlinks on page. Also, the links' data is retrieved from 
database table and one link per data table row. Currently you're wondering 
how to display them through html table element and each link item in a 
table cell, correct?

If this is the case, I think you can consider use the template in repeater 
control to declare the html table content. Since you're wantting to display 
the link items in html table cell(not row), we need to bread each <td> 
content into ItemTemplate. e.g:
=================
<asp:Repeater ID="Repeater1" runat="server">
        <HeaderTemplate><table><tr></HeaderTemplate>
        
        <ItemTemplate>
        <td>
        <a href="<%#   xxx %>" ......><%#   xxx %></a>
        </td>
        </ItemTemplate>
        
        <FooterTemplate></tr></table></FooterTemplate>
</asp:Repeater>
===================

This will help display each data item in an html table 
cell(<td>...</td>).And the links are displayed horizontally.

If we want to display them vertically, just change the template to divide 
each Item into html row (<tr>...). e.g:

=================
<asp:Repeater ID="Repeater1" runat="server">
        <HeaderTemplate><table></HeaderTemplate>
        
        <ItemTemplate>
        <tr>
        <td>
        <a href="<%#   xxx %>" ......><%#   xxx %></a>
        </td>
        </tr>
        </ItemTemplate>
        
        <FooterTemplate></table></FooterTemplate>
</asp:Repeater>
===================

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no 
rights.)




.



Relevant Pages

  • Ive become a hard-core userContent.CSS junkie !
    ... html, html * { ... display: inline!important;} ... Some of the schools have software developers... ... documenting the Source Code is different from documenting the app. ...
    (sci.physics)
  • Re: Redirecting between PHP Pages
    ... but at the very least in a php script. ... > on the outcome of the validation, you want to do one of two things: ... with the various bits of HTML being ... Display login form ...
    (comp.lang.php)
  • Re: formating text retrieved from a db
    ... You had to add HTML ... > If you were to display a phrase in your browser in simple HTML, ... They have a lofty name, ... has the formating with blank lines between the paragraphs etc. there is no ...
    (comp.lang.php)
  • Re: Am I on the right track here?
    ... that happens to be HTML ... | display rectangle for each video in that 4x2 layout, ... | display HTML relative to each rectangle. ... Once the server hands the page to the browser, the server, ...
    (comp.lang.php)
  • Re: Displaying HTML from memory
    ... IIS is out of the questione and I still don'w want to save HTML ... > you can pass a memory stream. ... > web page, you want to display, as a parameter. ... > read the stream and flush its contents to the HttpRespond.Output stream. ...
    (microsoft.public.dotnet.languages.csharp)

Loading