473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Simple grid/table display question.

I've got a simple form that collects data from a user and I want to display
that data in a sortable grid or table. The nature of this data is rather
temporary, so there's no need to persist it to a database. Searching through
the Framework documentation, everything I've seen reggarding a grids and
tables seems to require a connection to a database. My guess is I'm just
missing something. What classes can I use to display sortable data in a grid
or table that don't require a DB connection?

Thanks in advance,
Will.
Nov 15 '05 #1
5 3054
Will,

The DataGrid can connect to anything that implements IList. Each row
will be whatever is served up by the IList interface. The grid uses
reflection to get the columns. However, if the type implements ITypedList
(like the DataView does), then it will query the members of that interface
to get the columns.

Also, the DataSet class (and DataTable, etc, etc classes) are not
connected to a database. You can create them and populate them as you wish,
without a database connection, and then pass this to the grid for binding.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Will" <de*@rusmo.com> wrote in message
news:je********************@giganews.com...
I've got a simple form that collects data from a user and I want to display that data in a sortable grid or table. The nature of this data is rather
temporary, so there's no need to persist it to a database. Searching through the Framework documentation, everything I've seen reggarding a grids and
tables seems to require a connection to a database. My guess is I'm just
missing something. What classes can I use to display sortable data in a grid or table that don't require a DB connection?

Thanks in advance,
Will.

Nov 15 '05 #2
You can create a DataTable to use as the data source for
your grid. Filling that table from a db is one option,
but it is not required.

using System.Data;

DataTable myTable = new DataTable("Info");
myTable.Columns.Add("ID");
myTable.Columns.Add("Name");
myTable.Columns.Add("Address");

DataRow dr = myTable.NewRow();
dr["ID"] = "4A";
dr["Name"] = "Johnny Frank";
dr["Address"] = "456 Second St";
myTable.Rows.Add(dr);

dr = myTable.NewRow();
dr["ID"] = "13E";
dr["Name"] = "Dweezil";
dr["Address"] = "123 Main St";
myTable.Rows.Add(dr);

this.dataGrid1.DataSource = myTable;

Charlie
-----Original Message-----
I've got a simple form that collects data from a user and I want to displaythat data in a sortable grid or table. The nature of this data is rathertemporary, so there's no need to persist it to a database. Searching throughthe Framework documentation, everything I've seen reggarding a grids andtables seems to require a connection to a database. My guess is I'm justmissing something. What classes can I use to display sortable data in a gridor table that don't require a DB connection?

Thanks in advance,
Will.
.

Nov 15 '05 #3
Will,
I personaly prefer to keep things inside a Dataset. I provides alot of
functionality for knowing which rows of data have been modified, deleted and
so forth. You can easily create one and fill a DataTable inside it with
DataRows as the user enters data. From this table, you can create a
DataView which can sort and filter rows for you. You can then bind the
DataView to your Datagrid.

hope this helps

Marco

"Will" <de*@rusmo.com> wrote in message
news:je********************@giganews.com...
I've got a simple form that collects data from a user and I want to display that data in a sortable grid or table. The nature of this data is rather
temporary, so there's no need to persist it to a database. Searching through the Framework documentation, everything I've seen reggarding a grids and
tables seems to require a connection to a database. My guess is I'm just
missing something. What classes can I use to display sortable data in a grid or table that don't require a DB connection?

Thanks in advance,
Will.

Nov 15 '05 #4
thanks, Nicholas - you've been very helpful.
Nov 15 '05 #5
Perfect example - thanks for taking the time to include some source.

Will.
Nov 15 '05 #6

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

Similar topics

2
by: Jordan O'Hare | last post by:
Hello Everyone, I am after some help with the following: I have a windows application that contains a list box and two data grids. All three controls are binded to a dataset that contains...
4
by: Carlos Lozano | last post by:
Hello Folks! I have a grid that populates from a table on SQL Server. All datetime with DBNull value show 1/1/1900 12:00AM ... Instead of just blank (""). I found a document with the following...
3
by: pmud | last post by:
Hi, I have a web page (asp.net, code:c#). I havean html table with text boxes. Based on the user input , records are displayed in the data grid below it. Now the datagrid has a large no. of...
10
by: John Wilson | last post by:
My app produces some long datatables to display in a grid. So I put them in a div so users can scroll. But the grid headers scroll out of view. I would like to stop them doing this. Can I fix them...
13
by: Saber | last post by:
I did a lot of searches and read something about datagrids. But I couldn't find the answer of my simple question, how can I show only my desired columns of a table? for example I wrote this sql...
1
by: Jason | last post by:
Hello I've got a VB.net datagrid that I use to display some inforamtion from a Acess DB. In my datagrid I only display a few items of informatin, because there are just to many cells per tuple...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
0
by: simon | last post by:
hello, relatively new to .net, i'm using vb.net and the 2.0 .net platform I'm trying to display a grid that has a text box on the left in one cell (with a hidden ID), which will be associated...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.