Populating a datagrid ... how is it done normally?

Discussion in 'ASP .Net' started by Prime, Oct 1, 2004.

  1. Prime

    Prime Guest

    Hi All ...

    I'm writing a small shopping cart app (school assignment) and need to list
    all the books that a user selects.

    I have created a "BookBasket" object that contains among other things an
    arraylist of the user selected books. The "book" object contains isbn,title
    price and quantity information.

    I'd like to display the contents of the BookBasket in a datagrid control.

    I assume that to start with I'd have to iterate through the basket to
    identify each books information, but then how do I populate the datagrid
    from there?

    It seems from what I've read,that it is easier to populate a datagrid from a
    datasource, but I don't know how that would relate to what I'm doing.

    any clues or links to examples would be much appreciated.

    Thanks in advance

    Prime.
     
    Prime, Oct 1, 2004
    #1
    1. Advertising

  2. Prime

    Jared Guest

    Prime,
    There is a plethora of examples on using a datagrid control. Search
    google and you will find more than you need. The second article outlines
    what kind of datasources a datagrid will accept, an array is a valid data
    source so you won't have to write any code to fill another control. The
    third snippit supports my last statement.
    Hope this helps.
    Jared

    Here's one to get you started
    http://samples.gotdotnet.com/quicks...ms/ctrlref/webctrl/datagrid/doc_datagrid.aspx

    http://msdn.microsoft.com/library/d...skbindingthedatagridcontroltoanadodataset.asp

    You can bind to the following structures if their elements expose public
    properties:

    a.. Any component that implements the IList interface. This includes
    single-dimension arrays

    "Prime" <> wrote in message
    news:uIhFN$...
    > Hi All ...
    >
    > I'm writing a small shopping cart app (school assignment) and need to list
    > all the books that a user selects.
    >
    > I have created a "BookBasket" object that contains among other things an
    > arraylist of the user selected books. The "book" object contains
    > isbn,title
    > price and quantity information.
    >
    > I'd like to display the contents of the BookBasket in a datagrid control.
    >
    > I assume that to start with I'd have to iterate through the basket to
    > identify each books information, but then how do I populate the datagrid
    > from there?
    >
    > It seems from what I've read,that it is easier to populate a datagrid from
    > a
    > datasource, but I don't know how that would relate to what I'm doing.
    >
    > any clues or links to examples would be much appreciated.
    >
    > Thanks in advance
    >
    > Prime.
    >
    >
    >
    >
     
    Jared, Oct 1, 2004
    #2
    1. Advertising

  3. Prime

    Prime Guest

    Hi Jared,

    I think you've helped me before ... thank-you again.

    I found the gotdotnet sample very helpful. We are currently using a text
    book that is poor by any standard so your assistance is very much
    appreciated.

    The second sample was good, but we're not allowed to use a database
    interface! I originally coded my app that way,but was told that it was
    unacceptable. :( I found the database version extremely simple to code.)

    Again, thanks for you assistance.

    Prime.

    "Jared" <> wrote in message
    news:...
    > Prime,
    > There is a plethora of examples on using a datagrid control. Search
    > google and you will find more than you need. The second article outlines
    > what kind of datasources a datagrid will accept, an array is a valid data
    > source so you won't have to write any code to fill another control. The
    > third snippit supports my last statement.
    > Hope this helps.
    > Jared
    >
    > Here's one to get you started
    >

    http://samples.gotdotnet.com/quicks...ms/ctrlref/webctrl/datagrid/doc_datagrid.aspx
    >
    >

    http://msdn.microsoft.com/library/d...skbindingthedatagridcontroltoanadodataset.asp
    >
    > You can bind to the following structures if their elements expose public
    > properties:
    >
    > a.. Any component that implements the IList interface. This includes
    > single-dimension arrays
    >
    > "Prime" <> wrote in message
    > news:uIhFN$...
    > > Hi All ...
    > >
    > > I'm writing a small shopping cart app (school assignment) and need to

    list
    > > all the books that a user selects.
    > >
    > > I have created a "BookBasket" object that contains among other things an
    > > arraylist of the user selected books. The "book" object contains
    > > isbn,title
    > > price and quantity information.
    > >
    > > I'd like to display the contents of the BookBasket in a datagrid

    control.
    > >
    > > I assume that to start with I'd have to iterate through the basket to
    > > identify each books information, but then how do I populate the datagrid
    > > from there?
    > >
    > > It seems from what I've read,that it is easier to populate a datagrid

    from
    > > a
    > > datasource, but I don't know how that would relate to what I'm doing.
    > >
    > > any clues or links to examples would be much appreciated.
    > >
    > > Thanks in advance
    > >
    > > Prime.
    > >
    > >
    > >
    > >

    >
    >
     
    Prime, Oct 1, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Keith
    Replies:
    4
    Views:
    531
    Keith
    Jan 22, 2004
  2. =?Utf-8?B?YXJp?=

    how is this normally done?

    =?Utf-8?B?YXJp?=, Sep 30, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    374
    =?Utf-8?B?YXJp?=
    Oct 3, 2005
  3. dannyDog
    Replies:
    56
    Views:
    47,945
    George Cherry
    Jun 15, 2005
  4. Earl Eiland
    Replies:
    0
    Views:
    417
    Earl Eiland
    Feb 9, 2005
  5. semut
    Replies:
    12
    Views:
    569
Loading...

Share This Page