Nested Repeater

Discussion in 'ASP .Net Web Controls' started by DE_Kabal, Sep 7, 2006.

  1. DE_Kabal

    DE_Kabal Guest

    I relatively new to ASP.Net, coming from a ColdFusion background. I'm trying
    to create a report that does the following in a table:

    Organization1
    url pass failed
    url pass failed
    url pass failed
    Organization2
    url pass failed
    url pass failed
    url pass failed

    I tried using 2 SQLDataSources and could only get one organization then all
    the other data not sorted. I then tried the MicroSoft example, with some
    variation, and that didn't work. The result above comes from a single table.
    Here is the code I am using from the MS example:

    <asp:Repeater ID="parentRepeater" runat="server">
    <HeaderTemplate>
    <table border="1" cellpadding="3" cellspacing="0" summary="this table
    for layout">
    <tr>
    <td scope="col">Agency</td>
    </tr>
    </HeaderTemplate>
    <ItemTemplate>
    <tr>
    <td>
    <strong><%# DataBinder.Eval(Container.DataItem, "agency")
    %></strong>
    </td>
    <asp:Repeater ID="childRepeater" runat="server"
    DataSource='<%#
    Container.DataItem.Row.GetChildRows("myrelation") %>'>
    <ItemTemplate>
    <tr>
    <td><%# DataBinder.Eval(Container.DataItem, "url") %></td>
    <td><%# DataBinder.Eval(Container.DataItem, "filespass")
    %></td>
    <td><%# DataBinder.Eval(Container.DataItem, "filesfailed")
    %></td>
    </tr>
    </ItemTemplate>
    </asp:Repeater>
    </tr>
    </ItemTemplate>
    </asp:Repeater>

    Codebehind
    Dim strConn1 As String =
    ConfigurationManager.ConnectionStrings("accmon").ConnectionString
    Dim MySQL1 As String = "SELECT DISTINCT agency FROM websites WHERE
    webDelete = 0 AND webNew = 0"
    Dim MyConn1 As New OleDbConnection(strConn1)
    Dim cmd1 As New OleDbDataAdapter(MySQL1, MyConn1)
    Dim ds As DataSet = New DataSet()
    cmd1.Fill(ds, "websites")

    'Create table for child repeater
    Dim MySQL2 As String = "SELECT webID, url, files508, pass508,
    failed508, verify508 FROM websites " & _
    "WHERE webDelete = 0 AND webNew = 0"
    Dim cmd2 As New OleDbDataAdapter(MySQL2, MyConn1)
    cmd2.Fill(ds, "weburl")
    ds.Relations.Add("myrelation", _
    ds.Tables("websites").Columns("agency"), _
    ds.Tables("weburl").Columns("url"))
    parentRepeater.DataSource = ds.Tables("websites")
    Page.DataBind()
    MyConn1.Close()
    --
    cheers;
    DE_Kabal
     
    DE_Kabal, Sep 7, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    888
  2. Replies:
    0
    Views:
    2,915
  3. Replies:
    1
    Views:
    7,058
    Karl Seguin
    Aug 10, 2005
  4. uncensored
    Replies:
    0
    Views:
    836
    uncensored
    Oct 25, 2006
  5. Microsoft

    Repeater inside a Repeater

    Microsoft, Aug 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    220
    Microsoft
    Aug 21, 2006
Loading...

Share This Page