473,785 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1558
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" <NOtechieSPAMpu ndit_please@fut ure_avoidjunk_p undit.com>
wrote in message news:ex******** ******@TK2MSFTN GP09.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
3718
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 - like this: <p class="MsoNormal">Some text</p> now i'd like to remove them (the attributes, not the people, that is). i know reg exp is the way, but somehow the solution avoids me. just pointing me to some more advanced tutorial (pref. in...
8
2720
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 HTML to find these things. Right now, I'm doing a lot of "strstr" calls, but there is probably a better way to do what I need. Thanks for any help, - Dave
4
2453
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 elements and attributes (onclick, <script>, etc.). I would also like to do basic validation (no overlapping elements like <strong><em>foo</em></strong>, no missing end tags). I'm not asking anyone to write a script for me, but does anyone have general...
0
1053
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, Finereader, saves to HTML. I have begun to write stream editing scripts in python, but wonder whether someone else may have already done so. It would save me a lot of time to use or modify already-written utilities. I would appreciate direction to any...
5
3794
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? If not, is there an easy way to strip the html tags from the <definition> content before inserting the content into the meta tag?
4
8407
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 in JavaScript/JScript and HTML/XML elements. Without trying to get famous :-) but thinking it would be interesting to others I decided to post the following summary: 1. Variable names in JavaScript/JScript
7
18919
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 stylehseet or is it a bug of mozilla? I am asking this because of IE and Opera work differently here. <style>
9
2007
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. The DOM specification does not explicitly itself deprecate the use of attributes however for the element in the interface definition section I read. Is there text in the DOM specification that states specifically that the DOM specification...
3
2021
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. My issue: --------------------- When a blog's html has attributes with no quotes i get an exception.
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.