Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Populating a datagrid ... how is it done normally?

Reply
Thread Tools

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

 
 
Prime
Guest
Posts: n/a
 
      10-01-2004
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.




 
Reply With Quote
 
 
 
 
Jared
Guest
Posts: n/a
 
      10-01-2004
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/quickst..._datagrid.aspx

http://msdn.microsoft.com/library/de...adodataset.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" <(E-Mail Removed)> wrote in message
news:uIhFN$(E-Mail Removed)...
> 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.
>
>
>
>



 
Reply With Quote
 
 
 
 
Prime
Guest
Posts: n/a
 
      10-01-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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/quickst..._datagrid.aspx
>
>

http://msdn.microsoft.com/library/de...adodataset.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" <(E-Mail Removed)> wrote in message
> news:uIhFN$(E-Mail Removed)...
> > 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.
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I asked before and was told it could not be done, well its Done...?? Karen Parker NZ Computing 32 08-27-2004 07:21 AM
I asked before and was told it could not be done, well its Done...?? Karen Parker NZ Computing 7 08-26-2004 02:25 AM
Timeout on populating a datagrid Paul ASP .Net 4 05-05-2004 06:36 PM
How to let browsers be done when parent is done and not wait for childrn's finishing in CGI Zhidian Du Perl Misc 0 02-21-2004 07:01 PM
Populating a datagrid from two separate data sources John ASP .Net 1 07-31-2003 06:46 AM



Advertisments