Datagrid question

Discussion in 'ASP .Net' started by C Downey, Apr 15, 2004.

  1. C Downey

    C Downey Guest

    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 Downey, Apr 15, 2004
    #1
    1. Advertising

  2. C Downey

    Charlie@CBFC Guest

    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.



    "C Downey" <> wrote in message
    news:e$...
    > 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
    >
    >
    Charlie@CBFC, Apr 15, 2004
    #2
    1. Advertising

  3. C Downey

    Rick Spiewak Guest

    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.

    "C Downey" <> wrote in message
    news:e$...
    > 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
    >
    >
    Rick Spiewak, Apr 23, 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. Dave
    Replies:
    0
    Views:
    441
  2. BK Kim

    datagrid in datagrid

    BK Kim, Feb 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    537
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. =?Utf-8?B?U3VyZXNo?=
    Replies:
    0
    Views:
    521
    =?Utf-8?B?U3VyZXNo?=
    Mar 2, 2004
  4. Brian K. Williams
    Replies:
    0
    Views:
    543
    Brian K. Williams
    Mar 2, 2004
  5. Andreas Klemt
    Replies:
    0
    Views:
    292
    Andreas Klemt
    Oct 8, 2003
Loading...

Share This Page