473,505 Members | 14,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

should I bind datagrid to array or temporary dataset?

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
3 2288
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
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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3301
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on...
1
2239
by: Jim Hammond | last post by:
The code below implements two datagrid columns that display images. The first column is just a test that always displays the same image directly from a file. The second column pulls the image from...
4
4076
by: Greg Linwood | last post by:
I am wondering what the best approach to binding XML data to an asp:Table from the Page_Load event in a code behind module? I'm using VB.Net and initially approached this by adding a table to the...
6
5309
by: coleenholley | last post by:
I have a Class Module written in VB that calls an RPC (written in COBOL) we have written code to read the data from the RPC, and we create a temporary datatable to store the data from the RPC. This...
5
1629
by: Mark | last post by:
Can I bind datagrid to an xml string (not to file)? For example, the result of transformation?
7
2543
by: Jed | last post by:
I have a web service method that returns an array of custom objects marked serializeable with fully described public properties. When I bind the results to a DataGrid I can access the properties...
1
1263
by: Luis Esteban Valencia | last post by:
Please everybody participate in this question. Hello my applicacion has many layers and classes and I think its well structured. PLease let me know if you disagree and why. 1. I have the user...
17
2730
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
3
3269
by: serge calderara | last post by:
Dear all, Does anyone know how to bind a System.Collection.ArraysList object to a Dataset ? Thanks for your reply Regards Serge
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.