Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2004, 06:11 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Table control using ASP.Net

How to display the values from database in the table control. I know how to display in datagrid but not able to do the same with table control.

 
Old July 30th, 2004, 07:18 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

you can do it like below
--------
int numrows = 3;//optional
int numcells = 2;//optional
for (int j=0; j<numrows; j++) {
TableRow r = new TableRow();
     for (int i=0; i<numcells; i++) {
     TableCell c = new TableCell();
     //ds is your DataSet object should be filled before
     c.Controls.Add(new LiteralControl(ds.Tables[0].Rows[j][i].ToString()));
     r.Cells.Add(c);
                             }
     Table1.Rows.Add(r);
---------
I supposed the number of rows and columns in DataTable and Table object are the same.if not do it yourself(I think it could be very easy)
HTH.

--------------------------------------------
Mehdi.
 
Old July 30th, 2004, 10:06 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Why do you need to build your own table? The datagrid outputs a table already. And you should be able to change the appearance of the datagrid to look like a more simple table if that is what you are after.





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use asp.net we user control on asp 3.0 web i_shahid Java Basics 2 January 8th, 2008 09:04 AM
using asp.net web user control in asp 3.0 App i_shahid Classic ASP Professional 0 January 8th, 2008 07:32 AM
Control in ASP.NET Manisha0605 .NET Framework 2.0 1 March 29th, 2007 02:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.