468,791 Members | 1,823 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,791 developers. It's quick & easy.

Creating tables during runtime

Hello!

I'm trying to figure out how to do the following:

I need to show a table (perhaps using DataGrids, repeaters or others) for
each salesperson in the sales dept. But the no. of tables to be shown is to
be determined during runtime. It's possible that some salespersons have no
sales figures to begin with and therefore no table to show. Thanks in advance
and please help!
Nov 16 '05 #1
2 1554
If you just need to create a datatable

DataTable DT = new DataTable;
DT.Columns.Add("Col Name");

DataRow R;
R = DT.NewRow;
R[0] = "Row 1";
DT.Rows.Add(R);

DataGrid1.DataSource = DT;

Hope that helps. Note: Syntax might not be perfect, converted it over from
VB in my head.

Chris

"Newbie" <Ne****@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
Hello!

I'm trying to figure out how to do the following:

I need to show a table (perhaps using DataGrids, repeaters or others) for
each salesperson in the sales dept. But the no. of tables to be shown is
to
be determined during runtime. It's possible that some salespersons have no
sales figures to begin with and therefore no table to show. Thanks in
advance
and please help!

Nov 16 '05 #2
Hi Chris,

If I place a Panel on a Webform, then insert a Table (let's call this Outer
Table - only has one column) inside the Panel, and then insert another Table
(call it Inner Table) in one of the rows of the Outer Table, is there a way
to add new rows for the Outer Table during runtime? If so, is there a way to
replicate what's on the old row to the new row? In other words, is there a
way to copy what's on the existing row and replicate it on the newly added
row? I'm thinking that this is probably a way to add tables using DataGrids
during runtime. Each DataGrid sitting in each row. Thanks in advance.

Newbie
"Chris, Master of All Things Insignifican" wrote:
If you just need to create a datatable

DataTable DT = new DataTable;
DT.Columns.Add("Col Name");

DataRow R;
R = DT.NewRow;
R[0] = "Row 1";
DT.Rows.Add(R);

DataGrid1.DataSource = DT;

Hope that helps. Note: Syntax might not be perfect, converted it over from
VB in my head.

Chris

"Newbie" <Ne****@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
Hello!

I'm trying to figure out how to do the following:

I need to show a table (perhaps using DataGrids, repeaters or others) for
each salesperson in the sales dept. But the no. of tables to be shown is
to
be determined during runtime. It's possible that some salespersons have no
sales figures to begin with and therefore no table to show. Thanks in
advance
and please help!


Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Newbie | last post: by
12 posts views Thread by Mats Lycken | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.