473,657 Members | 2,415 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 2315
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************ ************@ya hoo.com> wrote in message
news:PO******** ********@twiste r.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******** *****@tk2msftng p13.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************ ************@ya hoo.com> wrote in message
news:PO******** ********@twiste r.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************ ************@ya hoo.com> wrote in message
news:xz******** ********@twiste r.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******** *****@tk2msftng p13.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************ ************@ya hoo.com> wrote in message
news:PO******** ********@twiste r.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
3317
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 different rows in the datagrid, the textbox content doesn't change to reflect the change. How can I address this? Also, If the user change the text in the textbox then how do I refesh the display in the datagrid to reflect the changes? ...
1
2258
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 the dataset. The datagrid contains several additional columns that are not seen here because they are automatically generated and bound to the dataset. All columns work except the second image column, which attempts to bind to the dataset. When...
4
4085
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 web page from the VS2003 ASP page designer, extracting an XML document from SQL Server during Page_Load, then adding asp:TableRows & asp:TableCells one at a time / loading the corresponding xml values a cell at a time. Is there a better (less...
6
5315
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 works fine when we call the datatable and bind it to a data grid using datagridname.DataBind(), but I have an ASP table, with calculations using tbl_name.row(1).cells(1) and the result of the calculation is put in a specific row and cell. I have...
5
1635
by: Mark | last post by:
Can I bind datagrid to an xml string (not to file)? For example, the result of transformation?
7
2558
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 in the ItemDataBound event of the codebehind but I can't access them declaratively in the HTML code? Here is the code to call the method. net.mysite.www.WSInterface proxy; proxy = new net.mysite.www.WSInterface();
1
1271
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 Interface (webforms) 2. I have a class Called Customer Class (it only has private fields, properties). Those properties connecto a Class called CustomerDALC (Customer Data Access Logic Component). this one must be the only responsible to access...
17
2747
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 allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
3
3282
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
8411
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2740
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 we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.