By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,610 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,610 IT Pros & Developers. It's quick & easy.

should I bind datagrid to array or temporary dataset?

P: n/a
AFN
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.
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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" <DE************************@yahoo.com> wrote in message
news:PO****************@twister.socal.rr.com...
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.

Nov 18 '05 #2

P: n/a
AFN
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" <ke***@takempis.com> wrote in message
news:OR*************@tk2msftngp13.phx.gbl...
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" <DE************************@yahoo.com> wrote in message
news:PO****************@twister.socal.rr.com...
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.


Nov 18 '05 #3

P: n/a
> 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?
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" <DE************************@yahoo.com> wrote in message
news:xz****************@twister.socal.rr.com... 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" <ke***@takempis.com> wrote in message
news:OR*************@tk2msftngp13.phx.gbl...
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" <DE************************@yahoo.com> wrote in message
news:PO****************@twister.socal.rr.com...
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.



Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.