Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

ASP.NET/VB arrayList and Table issue

asp.net array

  • Please log in to reply
1 reply to this topic

#1 encoded

encoded

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 18 November 2011 - 02:07 PM

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 : )
  • 0

#2 codehutch

codehutch

    CC Newcomer

  • Member
  • PipPip
  • 13 posts

Posted 22 November 2011 - 12:06 AM

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.

  • 0





Also tagged with one or more of these keywords: asp.net, array

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download