473,387 Members | 1,569 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,387 software developers and data experts.

Rules for using HTML tag attributes in ASP tags?

I'm wondering if there are general rules for the use of HTML attributes with ASP tags?

For example, one can set an id for an asp:DataGrid and it will show up as the id for
the resulting HTML table.

So then can one set, say, a class for an asp:DataGrid and all other asp tags that map
one-to-one to HTML tags and have it pass thru? I'd like to use class in particular to
map the resulting generated HTML to CSS names. I just tried this and this worked. The
CLASS showed up with the table tag as an attribute. Is it usually supposed to work?

Also, asp:DataGrid maps to table. So then can one just put cellpadding or other legal
attributes of a table as attributes for an asp:DataGrid attribute and have them pass
thru?

Doing this sort of thing with HTML tag attributes with ASP.Net tags seems to work.
But I'm wondering if this is considered normal practice or practice to avoid except
in rare cases or what?
Nov 19 '05 #1
1 1538
For the most part, unrecognized ASP.Net attributes are simply added to the
Attributes collection and outputted as-is. It can be useful in a number of
situations, and I've certainly done it now and again. However, sometimes
the two conflict. For example, specifying onClick on many controls invokes
the server-side method, hence you need to use xxx.Attributes.Add("OncClick",
"blah();"); in code. Never done it with class (which is a C#/vb.net
keyword), but you should first check if there's an asp.net control
alternative, such as cssClass

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit .com>
wrote in message news:ex**************@TK2MSFTNGP09.phx.gbl...
I'm wondering if there are general rules for the use of HTML attributes
with ASP tags?

For example, one can set an id for an asp:DataGrid and it will show up as
the id for the resulting HTML table.

So then can one set, say, a class for an asp:DataGrid and all other asp
tags that map one-to-one to HTML tags and have it pass thru? I'd like to
use class in particular to map the resulting generated HTML to CSS names.
I just tried this and this worked. The CLASS showed up with the table tag
as an attribute. Is it usually supposed to work?

Also, asp:DataGrid maps to table. So then can one just put cellpadding or
other legal attributes of a table as attributes for an asp:DataGrid
attribute and have them pass thru?

Doing this sort of thing with HTML tag attributes with ASP.Net tags seems
to work. But I'm wondering if this is considered normal practice or
practice to avoid except in rare cases or what?

Nov 19 '05 #2

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

Similar topics

7
by: chotiwallah | last post by:
i have a little database driven content managment system. people can load up html-docs. some of them use ms word as their html-editor, which resultes in loads of "class" and "style" attributes -...
8
by: laredotornado | last post by:
Hi, I'm using PHP 4 and trying to parse through HTML to look for HREF attributes of anchor tags and SRC attributes of IMG tags. Does anyone know of any libraries/freeware to help parse through...
4
by: Leif K-Brooks | last post by:
I'm writing a site with mod_python which will have, among other things, forums. I want to allow users to use some HTML (<em>, <strong>, <p>, etc.) on the forums, but I don't want to allow bad...
0
by: Jon Roland | last post by:
I have a number of changes I like to make to HTML files that are not currently supported by HTML Tidy. Most of them arise from OCR recognition errors, and many from the ways my OCR program,...
5
by: Donald Firesmith | last post by:
Are html tags allowed within meta tags? Specifically, if I have html tags within a <definition> tag within XML, can I use the definition as the content within the <meta content="description> tag? ...
4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
7
by: Marek Mänd | last post by:
When using <TABLE rules="all"> Mozilla 1.6 and previous versions draw a nasty interiour border, which doesnt go away though I have on TD's css border:none set. Is it something wrong with my...
9
by: Patient Guy | last post by:
Taking the BODY element as an example, all of its style attributes ('alink', 'vlink', 'background', 'text', etc.) are deprecated in HTML 4.01, a fact noted in the DOM Level 2 HTML specification. ...
3
by: apiringmvp | last post by:
All, So I am creating a function that gets a short blurb of html from a blog. I would like to retain all html formating and images. The code below works well, with the exception of one issue....
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.