|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Nested Repeaterto 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
Save Child GridView only when parent GridView Saved
Creating composite web controls Custom control with ListBox Selecting a value from a Gridview Control HyoerLink - need 2 params Select text in asp:textbox Auto postback in dropdownlist Failed to load viewstate. Getting error BC30560 with CR 11 Release 2 WebParts - can you transfer one users choice to all users? |
|||||||||||||||||||||||