tag <tbody> using TAble control

  • Thread starter Alhambra Eidos Kiquenet
  • Start date
A

Alhambra Eidos Kiquenet

Hi misters,

How I generate <tbody> tag using Table, TableRow, etc ... controls ?

I have this method:

private Table GenerarTablaOrdenacion(LinkButton lnkAscendente, LinkButton
lnkDescendente, Image imgAZ, Image imgZA)
{

Table table = new Table();
TableRow row1 = new TableRow();
TableCell col1 = new TableCell();
TableCell col2 = new TableCell();

col1.Style.Add(HtmlTextWriterStyle.Width, "6px");
col1.Controls.Add(imgAZ);
col2.Controls.Add(lnkAscendente);

row1.Cells.Add(col1);
row1.Cells.Add(col2);

TableRow row2 = new TableRow();
TableCell col21 = new TableCell();
TableCell col22 = new TableCell();col21.Style.Add(HtmlTextWriterStyle.Width,
"6px");
col21.Controls.Add(imgZA);
col22.Controls.Add(lnkDescendente);

row2.Cells.Add(col21);
row2.Cells.Add(col22);

table.Rows.Add(row1);
table.Rows.Add(row2);
return table;


Thanks in advance.
 
G

Guest

Hi misters,

How I generate <tbody> tag using Table, TableRow, etc ... controls ?

I have this method:

private Table GenerarTablaOrdenacion(LinkButton lnkAscendente, LinkButton
lnkDescendente, Image imgAZ, Image imgZA)
{

Table table = new Table();
TableRow row1 = new TableRow();
TableCell col1 = new TableCell();
TableCell col2 = new TableCell();

col1.Style.Add(HtmlTextWriterStyle.Width, "6px");
col1.Controls.Add(imgAZ);
col2.Controls.Add(lnkAscendente);

row1.Cells.Add(col1);
row1.Cells.Add(col2);

TableRow row2 = new TableRow();
TableCell col21 = new TableCell();
TableCell col22 = new TableCell();col21.Style.Add(HtmlTextWriterStyle.Width,
"6px");
col21.Controls.Add(imgZA);
col22.Controls.Add(lnkDescendente);

row2.Cells.Add(col21);
row2.Cells.Add(col22);

table.Rows.Add(row1);
table.Rows.Add(row2);
return table;

Thanks in advance.

--http://www.alhambra-eidos.es/web2005/index...topic.php?p=843www.trabajobasura.com/solusoft

I think you can use HtmlGenericControl instead

Example:

HtmlGenericControl tbl = new HtmlGenericControl("Table");
HtmlGenericControl tbody = new HtmlGenericControl("TBODY");
HtmlGenericControl row1 = new HtmlGenericControl("tr");
tbody.Controls.Add(row1);
....
 
B

bruce barker

this will not work (table only allows TableRows as children). you can't
do this with the builtin table class. you will need to write your own,
should be a pretty simple subclass.

-- bruce (sqlwork.com)
 
G

Guest

this will not work (table only allows TableRows as children). you can't
do this with the builtin table class. you will need to write your own,
should be a pretty simple subclass.

-- bruce (sqlwork.com)

Bruce,

HtmlGenericControl tbl = new HtmlGenericControl("table");
HtmlGenericControl tbody = new HtmlGenericControl("TBODY");
HtmlGenericControl row1 = new HtmlGenericControl("tr");
HtmlGenericControl cell1 = new HtmlGenericControl("td");
LiteralControl lt = new LiteralControl("Hallo, Welt");
cell1.Controls.Add(lt);
row1.Controls.Add(cell1);
tbody.Controls.Add(row1);
tbl.Controls.Add(tbody);
panel1.Controls.Add(tbl);

returns

<table><TBODY><tr><td>Hallo, Welt</td></tr></TBODY></table>
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top