473,383 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to form a method to change HTML TD Attributes when passed element ID?

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.

Changing the attributes of a SINGLE TD is simple:

<td id=thisTD runat=server>

thisTD.Attributes.Clear();
thisTD.Attributes.Add("Class",reader["thisTD_Class"].toString());

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.
Jul 21 '07 #1
2 1981
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.
--
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"
Jul 21 '07 #2
Thanks, 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]"
<re******@NOyahoo.SPAMcomwrote:
>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.
Jul 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM:...
72
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to...
8
by: TNGgroup | last post by:
Hi, Question, I have a simple form and want to submit a selected value of a combo box. so my combo box is named "selectname" and my form has action="file.asp?" what do I have to put after the...
4
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. ...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
3
by: Tabi | last post by:
Hi, I have just created a class that removes action attribute from HtmlForm. The code looks like here. namespace ComIT.Applications.Common { public class Form :...
3
by: Andy | last post by:
Hi, Have just found a bug in Netscape for some of my Javascript code - works ok in Internet Explorer. Given the following form element: <input type="text" compulsory = "yes" name="an_el"> ...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.