should I bind datagrid to array or temporary dataset? | | |
I need to manually create the data to be shown in a datagrid (or some data
table object). Should I create an array and bind the array to the
datagrid OR should I create a temporary dataset and bind that to the
datagrid? I have never done either (usually I get a recordset from a
stored procedure and bind results directly). I also don't know which is
faster. Whichever you suggest, can you give a couple lines of sample code?
Thank you. | | | | re: should I bind datagrid to array or temporary dataset?
A DataGrid has a good bit of overhead. You might want to think about using
something leaner, such as a Repeater or DataList. The chief advantage of a
DataGrid is paging, and if you don't need it, you might want to think about
one of the other 2. In any case, you said "create the data" - how you
display it depends on what kind of data it is. If, for example, you're
querying a database to get it, you can bind to a DataReader or DataTablle,
both of which can be populated easily from a database query. If not, again,
what format is this data in?
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"AFN" <DELETEnewsgroupCAPSaccount@yahoo.com> wrote in message
news:PO8Yb.4105$Le2.286@twister.socal.rr.com...[color=blue]
> I need to manually create the data to be shown in a datagrid (or some data
> table object). Should I create an array and bind the array to the
> datagrid OR should I create a temporary dataset and bind that to the
> datagrid? I have never done either (usually I get a recordset from a
> stored procedure and bind results directly). I also don't know which is
> faster. Whichever you suggest, can you give a couple lines of sample[/color]
code?[color=blue]
> Thank you.
>
>[/color] | | | | re: should I bind datagrid to array or temporary dataset?
Hi. For argument sake, we can say that I'll bind to a repeater. I was just
writing "datagrid" as an example.
I have to create the data in code. I cannot query the database. It's a
lot of math stuff that needs to be calculated in the code's business layer,
and then output to a table. As I create each row of data, I can store it
in any way before outputting to the html table. I can store to an array, or
a temporary dataset if that is better (I have not done that). Then I can
bind that datasource to the repeater object. But how can I do this? And
do I have to create an interface for the datasource? Or should I just
insert rows in an html table object as I create each row of data, and forget
data controls altogether?
"Kevin Spencer" <kevin@takempis.com> wrote in message
news:ORs2YdM9DHA.400@tk2msftngp13.phx.gbl...[color=blue]
> A DataGrid has a good bit of overhead. You might want to think about using
> something leaner, such as a Repeater or DataList. The chief advantage of a
> DataGrid is paging, and if you don't need it, you might want to think[/color]
about[color=blue]
> one of the other 2. In any case, you said "create the data" - how you
> display it depends on what kind of data it is. If, for example, you're
> querying a database to get it, you can bind to a DataReader or DataTablle,
> both of which can be populated easily from a database query. If not,[/color]
again,[color=blue]
> what format is this data in?
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "AFN" <DELETEnewsgroupCAPSaccount@yahoo.com> wrote in message
> news:PO8Yb.4105$Le2.286@twister.socal.rr.com...[color=green]
> > I need to manually create the data to be shown in a datagrid (or some[/color][/color]
data[color=blue][color=green]
> > table object). Should I create an array and bind the array to the
> > datagrid OR should I create a temporary dataset and bind that to the
> > datagrid? I have never done either (usually I get a recordset from a
> > stored procedure and bind results directly). I also don't know which[/color][/color]
is[color=blue][color=green]
> > faster. Whichever you suggest, can you give a couple lines of sample[/color]
> code?[color=green]
> > Thank you.
> >
> >[/color]
>
>[/color] | | | | re: should I bind datagrid to array or temporary dataset?
> do I have to create an interface for the datasource? Or should I just[color=blue]
> insert rows in an html table object as I create each row of data, and[/color]
forget[color=blue]
> data controls altogether?[/color]
That's a good question. My guess would be that unless you are planning to do
something else with the data, just writing it out to an HtmlTable would be
fine, and require less processing than any other solution.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"AFN" <DELETEnewsgroupCAPSaccount@yahoo.com> wrote in message
news:xz9Yb.4116$Le2.474@twister.socal.rr.com...[color=blue]
> Hi. For argument sake, we can say that I'll bind to a repeater. I was[/color]
just[color=blue]
> writing "datagrid" as an example.
>
> I have to create the data in code. I cannot query the database. It's a
> lot of math stuff that needs to be calculated in the code's business[/color]
layer,[color=blue]
> and then output to a table. As I create each row of data, I can store it
> in any way before outputting to the html table. I can store to an array,[/color]
or[color=blue]
> a temporary dataset if that is better (I have not done that). Then I can
> bind that datasource to the repeater object. But how can I do this? And
> do I have to create an interface for the datasource? Or should I just
> insert rows in an html table object as I create each row of data, and[/color]
forget[color=blue]
> data controls altogether?
>
>
> "Kevin Spencer" <kevin@takempis.com> wrote in message
> news:ORs2YdM9DHA.400@tk2msftngp13.phx.gbl...[color=green]
> > A DataGrid has a good bit of overhead. You might want to think about[/color][/color]
using[color=blue][color=green]
> > something leaner, such as a Repeater or DataList. The chief advantage of[/color][/color]
a[color=blue][color=green]
> > DataGrid is paging, and if you don't need it, you might want to think[/color]
> about[color=green]
> > one of the other 2. In any case, you said "create the data" - how you
> > display it depends on what kind of data it is. If, for example, you're
> > querying a database to get it, you can bind to a DataReader or[/color][/color]
DataTablle,[color=blue][color=green]
> > both of which can be populated easily from a database query. If not,[/color]
> again,[color=green]
> > what format is this data in?
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "AFN" <DELETEnewsgroupCAPSaccount@yahoo.com> wrote in message
> > news:PO8Yb.4105$Le2.286@twister.socal.rr.com...[color=darkred]
> > > I need to manually create the data to be shown in a datagrid (or some[/color][/color]
> data[color=green][color=darkred]
> > > table object). Should I create an array and bind the array to the
> > > datagrid OR should I create a temporary dataset and bind that to the
> > > datagrid? I have never done either (usually I get a recordset from a
> > > stored procedure and bind results directly). I also don't know which[/color][/color]
> is[color=green][color=darkred]
> > > faster. Whichever you suggest, can you give a couple lines of sample[/color]
> > code?[color=darkred]
> > > Thank you.
> > >
> > >[/color]
> >
> >[/color]
>
>[/color] |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,272 network members.
|