Hey,
Having a little issue here. I am trying to loop through a datatable and create a new pane for each group of client numbers. I think I am having trouble with how I dim my new accordion pane. I am trying to use just one variable but it doesn't seem to like that as it tries to add everything togeter into one pane.
vb Code:
Private Sub LoadAccordion() Dim dt As DataTable Dim stClientNO As String = "0" Dim cmd As New XSQL("XXXXX", 2) Dim stHeadString As String Try cmd.AddStrParam("@clClient", txtClientNo.Text, 20) cmd.AddStrParam("@clName", txtClientName.Text, 100) dt = cmd.ExecuteDS("USP_GetClientAddress").Tables(0) If dt.Rows.Count = 0 Then lblError.Text = "There were no results to the query. Please try again." Else 'loop and add panes Dim ap1 As New AccordionPane For Each row As DataRow In dt.Rows 'if new number add header If row("claClient") <> stClientNO Then If stClientNO <> "0" Then Acc1.Panes.Add(ap1) 'ap1.Controls.Clear() 'nothing appears using this End If stHeadString = row("claClient") & " - " & row("clname") ap1.HeaderContainer.Controls.Add(New LiteralControl(stHeadString)) stClientNO = row("claClient") End If 'add content ap1.ContentContainer.Controls.Add(New LiteralControl(ContentString(row))) Next lblError.Text = "" End If Catch ex As Exception lblError.Text = ex.Message End Try End Sub
I know my logic is flawed but what would be the best way to get this working?
Thanks!




Reply With Quote