Results 1 to 2 of 2

Thread: [Semi-Resolved] [2005] Adding AJAX accordion panes dynamically

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    [Semi-Resolved] [2005] Adding AJAX accordion panes dynamically

    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:
    1. Private Sub LoadAccordion()
    2.         Dim dt As DataTable
    3.         Dim stClientNO As String = "0"
    4.         Dim cmd As New XSQL("XXXXX", 2)
    5.         Dim stHeadString As String
    6.  
    7.         Try
    8.             cmd.AddStrParam("@clClient", txtClientNo.Text, 20)
    9.             cmd.AddStrParam("@clName", txtClientName.Text, 100)
    10.             dt = cmd.ExecuteDS("USP_GetClientAddress").Tables(0)
    11.             If dt.Rows.Count = 0 Then
    12.                 lblError.Text = "There were no results to the query. Please try again."
    13.             Else
    14.                 'loop and add panes
    15.                 Dim ap1 As New AccordionPane
    16.                 For Each row As DataRow In dt.Rows
    17.                     'if new number add header
    18.                     If row("claClient") <> stClientNO Then
    19.                         If stClientNO <> "0" Then
    20.                             Acc1.Panes.Add(ap1)
    21.                             'ap1.Controls.Clear() 'nothing appears using this
    22.                         End If
    23.                         stHeadString = row("claClient") & " - " & row("clname")
    24.                         ap1.HeaderContainer.Controls.Add(New LiteralControl(stHeadString))
    25.                         stClientNO = row("claClient")
    26.                     End If
    27.                     'add content
    28.                     ap1.ContentContainer.Controls.Add(New LiteralControl(ContentString(row)))
    29.                 Next
    30.                 lblError.Text = ""
    31.             End If
    32.         Catch ex As Exception
    33.             lblError.Text = ex.Message
    34.         End Try
    35.  
    36.  
    37.     End Sub

    I know my logic is flawed but what would be the best way to get this working?

    Thanks!
    Last edited by Besoup; Oct 28th, 2008 at 01:22 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width