Equivalent of TableRow and TableCell class

R

Rajeev

Hi
I can use the TableRow and TableCell class in C# while using Web
forms. The same are not available while programming with Windows
Forms. I have the folloowing code that works fine with Web forms but
returns error with Windows Forms. How can I make it run for Windows
forms:

TableRow r;
TableCell c;

for (j=0; j < colCount; j++)
{
r= new TableRow();
c = new TableCell();
c.Controls.Add(new LiteralControl(DS.Tables[0].Columns[j].ColumnName));
c.VerticalAlign = VerticalAlign.Top;
c.Style["background-color"] = "lightblue";
r.Cells.Add(c);

for (i = 0; i {
c = new TableCell();
c.Controls.Add(new LiteralControl(dataArray[j]));
c.VerticalAlign = VerticalAlign.Top;
r.Cells.Add(c);
}

Table1.Rows.Add(r);
}

}
 
S

Shakir Hussain

Rajeev,

In windows forms commonly used grid is datagrid. To construct the grid,
DataTable, DataRow, DataColumn classes are used and finally assigned to
Datasource property for unbound grid.

If you want to construct a HTML table in Webbrowser component using
HTMLDocumentClass, there are bunch of classes like HTMLTableClass,
HTMLTableCellClass, HTMLTableRowClass is available to construct tables. To
get access to these classes you have to include "using mshtml" namespace,
 
N

navvy savvy

Thanks
Could you please convert the code I had listed so it can be used in
Windows Form application.

Thanks



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
L

learningcsharp2003

Hi
I am facing the same problem. I am using WindowsForms and would like
to know how to display columns as rows.

Thanks
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top