Datagrid question

C

C Downey

I have a web page that I displays the search results from another form. The
way I have it developed right now, my data access layer returns me the
results as an array (first name, lastname, id). When the results are
returned I want to display them in a table that allows paging if too many
results are returned.

One way of displaying my results is to have my data access object return me
a dataset and bind the dataset to a datagrid in my aspx page. There is the
potential for up to a hundred records (I cap it at 100) being returned,
which is relatively few records, however this page will take a lot of hits.
Is it bad practice to return a dataset from a DAL to the aspx page?

Other wise I will probably end up returning an array with the information
and loop through it to manually write out my table of results (but this does
not allow paging and I would prefer not to have to code that by hand)

Since displaying data is such a common thing, I am wondering what do you
guys do to display data and how do you return your data to your aspx page
from you data access layer.

TIA
-c
 
C

Charlie@CBFC

Create a SQL or OLEDb connection to your datasource and return a reader or
table in a dataset object. Then bind to grid by calling its databind()
method. By default, the grid will generate columns. You can customize grid
using template columns.
 
R

Rick Spiewak

You should be fine returning a dataset. But, you can bind directly to an
arraylist, or even a collection of custom objects where the collection
object inherits system.collections.collectionbase. You can bind directly to
the properties of the objects which make up the collection. This might be a
useful approach as well.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top