Jump to content

ASP.NET/VB arrayList and Table issue

- - - - -

  • Please log in to reply
1 reply to this topic

#1
encoded

encoded

    Newbie

  • Members
  • Pip
  • 1 posts
Hi, I only had one semester of ASP.NET months back ago (was not a 2 semester core language class) and graduated about 6 months ago. I am tinkering around with this language and found myself in a bit of a situation. Using a Table form the Standard, Tool bar..is there or isn't there a way to make an arrayList in the VB.net code behind, and populate that Table? And no,..I am not using, or want to use a database. Tables can not use a "DataSource" since this is not using a database, correct? So can you tie the two (VB Table and ASP.NET) together?

( roughly said, make a arrayList of cars per-say, and have the arrayList populated to a ASP.NET table to be rendered on a site...and again..not
database driven or loaded)

Thanks to all for any input...'lil lost on this one..


p.s. not a student so this is not homework : )

#2
codehutch

codehutch

    Newbie

  • Members
  • PipPip
  • 13 posts
Hi,

Don't you want to use DataGrid? It's seems to be appropriate in this situation. You can make arrayList as its datasource, plus it looks like a table too :) Here's a sample code:

ASP
 <asp:DataGrid ID="DefaultGrid" Runat="server"> </asp:DataGrid>

VB .Net

        Dim ItemList As New ArrayList()


        ' Add some random Numbers

        Dim r As New Random()

        For i As Integer = 0 To 10

            ItemList.Add(r.Next)

        Next


        DefaultGrid.DataSource = ItemList

        DefaultGrid.DataBind()

Let me know if you're having trouble implementing it.



=========================
Online Code Repository

Edited by codehutch, 22 November 2011 - 10:23 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users