473,948 Members | 21,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying data in a datagrid

Hi

What is the best way to populate a datagrid?, can you populate it row by row using a datareader or is dataAdapater.Fi ll then Dataset binding the only way

John
Nov 18 '05 #1
4 1271
The data doesn't have to come from a DataAdapter, but calling
dataGrid.DataBi nd after setting its dataSource is the only way.
"John" <an*******@disc ussions.microso ft.com> wrote in message
news:F5******** *************** ***********@mic rosoft.com...
Hi,

What is the best way to populate a datagrid?, can you populate it row by row using a datareader or is dataAdapater.Fi ll then Dataset binding the only
way?
John

Nov 18 '05 #2
What are the different ways of populating the datagrid, can I do it one row at a time.

----- Scott M. wrote: -----

The data doesn't have to come from a DataAdapter, but calling
dataGrid.DataBi nd after setting its dataSource is the only way.
"John" <an*******@disc ussions.microso ft.com> wrote in message
news:F5******** *************** ***********@mic rosoft.com...
Hi,
What is the best way to populate a datagrid?, can you populate it row by row using a datareader or is dataAdapater.Fi ll then Dataset binding the only
way? John


Nov 18 '05 #3
I answered that question already....When you set the DataGrid.DataSo urce
property you are telling the grid where ALL the data is that it will be
bound to. When you call DataGrid.DataBi nd, you are instructing the grid to
bind itself to ALL of the data. You can't do it one record at a time. This
is the only way to populate a DataGrid.

If you want that functionality, look into building an HTML table dynamically
(like the way we did it in classic ASP).
"John" <an*******@disc ussions.microso ft.com> wrote in message
news:4F******** *************** ***********@mic rosoft.com...
What are the different ways of populating the datagrid, can I do it one row at a time.
----- Scott M. wrote: -----

The data doesn't have to come from a DataAdapter, but calling
dataGrid.DataBi nd after setting its dataSource is the only way.
"John" <an*******@disc ussions.microso ft.com> wrote in message
news:F5******** *************** ***********@mic rosoft.com...
> Hi,
>> What is the best way to populate a datagrid?, can you populate it
row by
row using a datareader or is dataAdapater.Fi ll then Dataset binding the only way? >> John


Nov 18 '05 #4

- you can use a sqlcommand to write a query and retrieve the records i
a datatable or dataview and bind it to the datagrid

- you can use the dataadapter method

I think you are thinking in terms of classic ASP - do while no
rs.EOF.....rs.M oveNext

You cant do that here.
You can however have complete control over the datagrid to display wha
columns and what rows by setting the Datagrids AutoGenerateCol umn
property to FALSE and using the ItemBound method to display data.

newsgroup user wrote:
*Hi,

What is the best way to populate a datagrid?, can you populate it ro
by row using a datareader or is dataAdapater.Fi ll then Datase
binding the only way?

John


ajaymehr
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message380997.htm

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1977
by: pmud | last post by:
Hi, I have 4 columns in my sql database table. I added a data adapter , data set & a data grid to view this information. But the data grid is displaying those 4 columns TWICE , i.e in the data grid i see 8 columns. In case this is useful, the primary key is Serial no. which is an identity ....i.e everytime a row is added to the database, it increments by1. Also, when i configured the data adapter, it couldnt Generate the UPDATE &...
12
2468
by: Charles Astwood | last post by:
Hi, just starting out working my way round C Sharp and aspx. Used to write all my sites in asp and just need a few pointers in how to display data. I have made a connection to my SQL2000 database with SqlConnection as I think this is the fastest and best? I have also written my SELECT statement, but am confused in how to display this data not in a Table as all the examples on the web seem to want me to
3
2560
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
2
2965
by: VM | last post by:
When I display data to a Windows datagrid I usually fill the underlying table (in another class) and then, once it contains all the data, I attach it to the grid. But there are some processes that involve large amounts of data so the user won't be able to see anything in the grid until after the table's already filled up (usually 40-60 secs with these large processes). Is it possible (without changing the process of filling the table...
2
1655
by: scott | last post by:
Hi all, Iv got a slight problem with a datagrid and the ability to only display certain things in it. I have a Data grid which is connected to a data table. The data table is connected to a data set which in turn gets its info from
3
4937
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls are Web Control & not HTML control. One of these buttons whose title is Delete is added on the aspx page in design view & also I double clicked on this button in design view to get the onclick code for this button in the code behind page. & for...
0
1606
by: Craig | last post by:
Hello, I have a web form that allows the user to move a unit on a manufacturing router. The user click one of five buttons which each represent a step on the router. When the user clicks any of the five buttons, I do a SQL select to gather some data about this unit and populate a datagrid w/ the resulting data. I want the data in the datagrid to be displayed to the user, and THEN I want to prompt the user w/ a messagebox(), that ask...
0
1524
by: latin & geek via DotNetMonster.com | last post by:
hi! ok, im working on a database application. ive successfully managed to establish a relationship between two tables and display them on a datagrid, edit and add new records to them. now i need to generate a report using the parameters in the child table, and two columns from the parent table. this is where the problem starts. when i use two seperate connection links and extract the required data, adding it all to the same dataset,...
1
1279
by: Death | last post by:
Hi all I am having some trouble on displaying datagrid data from my database as i am a beginner for this The error is when calling the DBCommand . It show incorrect syntax near User. But User is the table in my server. Did i do anything wrong? Pls advice .Thanks Below is the code sample :
0
9989
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11183
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
10697
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...
1
8261
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7434
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
6122
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
4952
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
4545
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3550
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.