Saturday, March 24, 2012

tag <tbody> using TAble control

Hi misters,

How I generate <tbodytag 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.Wi dth,
"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.html
www.kiquenet.net
http://www.setbb.com/putainformatic...topic.php?p=843
www.trabajobasura.com/solusoftOn Nov 28, 9:29 am, Alhambra Eidos Kiquenet
<AlhambraEidosKique...@.discussions.microsoft.comwro te:

Quote:

Originally Posted by

Hi misters,
>
How I generate <tbodytag 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.Wi dth,
"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.htmlwww.kiquenet.nethttp://www.setbb.com/putainformatica/viewtopic.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);
...
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)

Alexey Smirnov wrote:

Quote:

Originally Posted by

On Nov 28, 9:29 am, Alhambra Eidos Kiquenet
<AlhambraEidosKique...@.discussions.microsoft.comwro te:

Quote:

Originally Posted by

>Hi misters,
>>
>How I generate <tbodytag 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.Wi dth,
>"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.htmlwww.kiquenet.nethttp://www.setbb.com/putainformatica/viewtopic.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);
...


On Nov 28, 6:03 pm, bruce barker <nos...@.nospam.comwrote:

Quote:

Originally Posted by

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>

0 comments:

Post a Comment