How to form a method to change HTML TD Attributes when passed element ID?
am 21.07.2007 14:36:25 von ShannonHello, thank you for taking the time to read this. I am totally
stumped on this one.
I have a ton of TD attributes that have to be changed based on the
data in the DB. All TD elements are ID and runat=server.
Changing the attributes of a SINGLE TD is simple:
thisTD.Attributes.Clear();
thisTD.Attributes.Add("Class",reader["thisTD_Class"].toStrin g());
Now, say we have 100 TD elements with IDs TD_1 to TD_100
I have not been able to find a way to (essentially) say:
for(int i=0;i<100;i++){
"TD_"+i.Attributes.Clear();
"TD_"+i.Attributes.Add("Class",reader["TDClass"+i].toString( ));
}
in J-Script, I could do it by Eval() or about eight ways through the
DOM. It seems crazy to me that if I can access the Attributes of a
specific element directly by ID (thisTD.Attributes), I couldn't also
access it by reference.
But I have been able to find NOTHING to indicate how this may be done.
Obviously, my problem is not limited to a single attribute, or else I
would have just typed them all out by now. Trouble is, there is a lot
of logic that must be applied to the data before setting the
attribute. Without being able to iterate or loop by reference, I will
be typing for ages just to change some freaking classes.
Thanks in advance for any help or information you can provide.
Re: How to form a method to change HTML TD Attributes when passed element ID?
am 21.07.2007 15:03:53 von reb01501Shannon wrote:
> Hello, thank you for taking the time to read this. I am totally
> stumped on this one.
>
> I have a ton of TD attributes that have to be changed based on the
> data in the DB. All TD elements are ID and runat=server.
>
This sounds like an asp.net question (I'm not sure what you mean by "ID")
so:
There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic asp newsgroup. ASP.Net bears
very little resemblance to classic ASP so, while you may be lucky enough to
find a dotnet-knowledgeable person here who can answer your question, you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
There are also forums at www.asp.net.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Re: How to form a method to change HTML TD Attributes when passed element ID?
am 21.07.2007 15:51:32 von ShannonThanks, Bob -- I appreciate the friendly nudge. I saw some ASPX and
other NET references in posted headers, and just made the assumption
that this group appliet to the .NET framework, as well.
It is indeed a .NET issue -- I am a legacy-head myself, and only now
(by force) attempting to adopt the complexities of .NET
In legacy, I can code as fast as I can type -- in .NET things still
take forever.
Anyway, I again appreciate the pointer, and will re-post this thread
to the other group.
On Sat, 21 Jul 2007 09:03:53 -0400, "Bob Barrows [MVP]"
>Shannon wrote:
>> Hello, thank you for taking the time to read this. I am totally
>> stumped on this one.
>>
>> I have a ton of TD attributes that have to be changed based on the
>> data in the DB. All TD elements are ID and runat=server.
>>
>
>This sounds like an asp.net question (I'm not sure what you mean by "ID")
>so:
>There was no way for you to know it (except maybe by browsing through some
>of the previous questions in this newsgroup before posting yours - always a
>recommended practice) , but this is a classic asp newsgroup. ASP.Net bears
>very little resemblance to classic ASP so, while you may be lucky enough to
>find a dotnet-knowledgeable person here who can answer your question, you
>can eliminate the luck factor by posting your question to a group where
>those dotnet-knowledgeable people hang out. I suggest
>microsoft.public.dotnet.framework.aspnet.
>There are also forums at www.asp.net.