[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

Reference to a TableRow with a dynamic name

(VidalSasoon)

12/25/2002 10:27:00 PM

Is there any way that I could do this:

String dynamictablerow = "tr" + counter; // This refers to the tablerow ID's

dynamictablerow.Visible = true; // does not work


Obviously, the compiler says "dynamictablerow" is a string and will not work.
How could i set the tablerow to visible if i don't know what the name is?
2 Answers

Ryan De Laet

12/19/2002 1:38:00 AM

0

Not sure what you mean...

for clientside stuff : In the OnRender method, you could blatantly assign
the ID, so you automatically know what it is....
like so:
AddAttributesToRender(output);
output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0", false);
output.RenderBeginTag(HtmlTextWriterTag.Table); //Start Table
//First Row
output.AddAttribute(HtmlTextWriterAttribute.Id, "MyTR" +
someIncrementVariable.ToString() , false);
output.RenderBeginTag(HtmlTextWriterTag.Tr); //Start Tr

And use styles to set visibility, or JS if you want to generate.
-= Ryan =-


"VidalSasoon" <vidalsasoon@bootbox.net> wrote in message
news:9f70af8d.0212181613.79046848@posting.google.com...
> Is there any way that I could do this:
>
> String dynamictablerow = "tr" + counter; // This refers to the tablerow
ID's
>
> dynamictablerow.Visible = true; // does not work
>
>
> Obviously, the compiler says "dynamictablerow" is a string and will not
work.
> How could i set the tablerow to visible if i don't know what the name is?


(VidalSasoon)

12/25/2002 10:27:00 PM

0

The problem is that I know the ID of my TableRow but since I only know
the name and do not have the actual object, I cannot modify its
properties.

What I need is something like eval from javascript. This is server
side however...


"Ryan De Laet" <RyanDeLaet@hotmail.com> wrote in message news:<u4imtcvpCHA.2252@TK2MSFTNGP12>...
> Not sure what you mean...
>
> for clientside stuff : In the OnRender method, you could blatantly assign
> the ID, so you automatically know what it is....
> like so:
> AddAttributesToRender(output);
> output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0", false);
> output.RenderBeginTag(HtmlTextWriterTag.Table); //Start Table
> //First Row
> output.AddAttribute(HtmlTextWriterAttribute.Id, "MyTR" +
> someIncrementVariable.ToString() , false);
> output.RenderBeginTag(HtmlTextWriterTag.Tr); //Start Tr
>
> And use styles to set visibility, or JS if you want to generate.
> -= Ryan =-
>
>
> "VidalSasoon" <vidalsasoon@bootbox.net> wrote in message
> news:9f70af8d.0212181613.79046848@posting.google.com...
> > Is there any way that I could do this:
> >
> > String dynamictablerow = "tr" + counter; // This refers to the tablerow
> ID's
> >
> > dynamictablerow.Visible = true; // does not work
> >
> >
> > Obviously, the compiler says "dynamictablerow" is a string and will not
> work.
> > How could i set the tablerow to visible if i don't know what the name is?