[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Setting HtmlTableCell attributes from code behind

Praveen Naregal

3/1/2004 7:25:00 AM


Hello all,

I am trying to set the "a href" attribute of HtmlTableCell in ASP.NET from
VS.NET. The attribute is not getting set and hyperlink is not getting
displayed. Can anybody point out the error? A piece of code demonstrating
setting this property would be helpful.

System.Web.UI.HtmlControls.HtmlTableCell cell1 = new
System.Web.UI.HtmlControls.HtmlTableCell();

cell1.InnerText = sub;
string val = "default.aspx?id="+id+"AcntName="+ActiveAcnt;
cell1.Attributes.Add("nowrap","nowrap");
cell1.Attributes.Add("a href",val);
item.Cells.Add(cell1);


Thanks in advance
Praveen Naregal


1 Answer

Alessandro Zifiglio

3/1/2004 7:37:00 AM

0

i dont know what you are after, and why you need a table cell with an
illegal href attribute, however I assure you that your code sample works and
this is the output :

<table>
<tr>
<td nowrap="nowrap" ahref="default.aspx?id=0AcntName=0">My special cell
that hypers</td>
</tr>
</table>

Maybe you want to give more details as to what method you tried this in and
at what stage of your pages lifecycle.

If your trying to make the cell clickable then you are definately going
about this the wrong way. A table cell with a href attribute ? ;P



"Praveen Naregal" <pgnaregal@hotmail.com> wrote in message
news:OXria11$DHA.1212@TK2MSFTNGP12.phx.gbl...
>
> Hello all,
>
> I am trying to set the "a href" attribute of HtmlTableCell in ASP.NET from
> VS.NET. The attribute is not getting set and hyperlink is not getting
> displayed. Can anybody point out the error? A piece of code demonstrating
> setting this property would be helpful.
>
> System.Web.UI.HtmlControls.HtmlTableCell cell1 = new
> System.Web.UI.HtmlControls.HtmlTableCell();
>
> cell1.InnerText = sub;
> string val = "default.aspx?id="+id+"AcntName="+ActiveAcnt;
> cell1.Attributes.Add("nowrap","nowrap");
> cell1.Attributes.Add("a href",val);
> item.Cells.Add(cell1);
>
>
> Thanks in advance
> Praveen Naregal
>
>