473,804 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.ASP Properties vs Attributes

Reading a book on .ASP .NET I am getting a bit mixed up as to the difference
between "property" and "attribute" as the terms don't seem to be used
consistently in the book I am reading. Can anyone give two good definitions?
Both with respect to controls.


Nov 16 '05 #1
13 3141
Patrick,

I don't know your book, however an attribute is used as they belong to HTML
controls (which the servercontrols on the client side are as well). Height,
Width on the client side is an attribute.

While when you are using them in your code in C# directly it are properties.

Maybe I can show it you with this piece of code.
\\\
private void Page_Load(objec t sender, System.EventArg s e) {
if (!IsPostBack)
{
this.Button1.Te xt = "Send Mail";
this.Button1.At tributes["onClick"] =
"window.locatio n='mailto:no*@n on.com?subject= Cor demo&body=I hope this
helps?';";
}}
///
In this.Button1 is Attributes a property that sets an Attribute in the HTML
form (clientside)

I hope this helps?

Cor

"Patrick *" <wa********@all .here>
Reading a book on .ASP .NET I am getting a bit mixed up as to the
difference
between "property" and "attribute" as the terms don't seem to be used
consistently in the book I am reading. Can anyone give two good
definitions?
Both with respect to controls.


Nov 16 '05 #2
Patrick * wrote:
Reading a book on .ASP .NET I am getting a bit mixed up as to the difference
between "property" and "attribute" as the terms don't seem to be used
consistently in the book I am reading. Can anyone give two good definitions?
Both with respect to controls.


Not having the book text available it's hard to tell wether they are
mixing up the words or if you're mixing up attributes and properties.

The .NET definition of the two are:

A property is something part of a class, like Name. You access it like this:

obj.Name = "Hello";

or similar. This executes some code in order to store the new value in
the object.

For components/controls you drop on form, these are the things you get
in the Properties window when you select it.

An attribute is something different and is only relevant in source code.

for a class, defined like this:

public class YourClass {...}

an attribute could be applied to it like this:

[AttributeName(p arameters to attribute here)]
public class YourClass {...}

Some attributes are used to tell the compiler to do something specific
with whatever the attribute is applied to, other attributes are simply
stored in the assembly for future reference. For instance, you can
iterate through all types in an assembly and check if each has a
specific attribute applied to it.

If your book talks about properties and calling them attributes, well,
then I don't know what they're doing.

A html tag, like <a href="xyz"> has attributes in the sense that "href"
is an attribute of the "A" tag. ASP.NET controls store some of the
property values in attributes like this. This could be what they're
talking about.

--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
mailto:la***@vk arlsen.no
PGP KeyID: 0x0270466B
Nov 16 '05 #3

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:eg******** ******@tk2msftn gp13.phx.gbl...

Hey guys, these explanations, however valuable are no definitions.
Nov 16 '05 #4
Zach,

What is a definition when some people calls something an attribute and the
others a property.

Asked is how it is used in ASPNET and there they are mixed up when it is on
clientside or on serverside.
http://msdn.microsoft.com/library/de...htopic.aspWhen you want a definition than you can look in a dictionary however incomputer bussiness definitions are not always used right.http://dictionary.reference.com/sear...=attributeJust my thoughtsCor"Zac h" <cs**********@f reeler.nl>> Hey guys, these explanations, however valuable are no definitions.>>

Nov 16 '05 #5
I don't know why it became all together

Zach,

What is a definition when some people calls something an attribute and the
others a property.

Asked is how it is used in ASPNET and there they are mixed up when it is on
clientside or on serverside.
http://msdn.microsoft.com/library/de...htopic.aspWhen you want a definition than you can look in a dictionary howeverincomput er bussiness definitions are not always used right.http://dictionary.reference.com/sear...=attributeJust my thoughtsCor

Nov 16 '05 #6
It was too much work to make this message not trying it to get it sent
correct.

What is a definition when some people calls something an attribute and the
others a property.

Asked is how it is used in ASPNET and there they are mixed up when it is on
clientside or on serverside.

http://msdn.microsoft.com/library/de...es/width_2.asp

---

http://msdn.microsoft.com/library/de...widthtopic.asp

When you want a definition than you can look in a dictionary
howeverincomput er bussiness definitions are not always used right.

http://dictionary.reference.com/search?q=property
----

http://dictionary.reference.com/search?q=attribute

Just my thoughts

Cor
Nov 16 '05 #7
The terms attribute and property are related in that, in the design phase of
a project, you define attributes of objects - for instance, an attribute of a
car is its color. When you create a car class, you then create a color
property to describe that attribute. It is this relationship that it sounds
like, to me, that you may be getting confused about from your book.

I say this, because there's another attribute definition which is different
enough from a property that it shouldn't be as confusing - the
System.Attribut e class and objects created from that class. You can read the
values of attributes in code and respond appropriately.

In Visual Studio .Net, there is an attribute class. Attributes are placed
into your source code to describe code or control compiler behavior. You can
read the values of the attributes and act accordingly in your code.

"Patrick *" wrote:
Reading a book on .ASP .NET I am getting a bit mixed up as to the difference
between "property" and "attribute" as the terms don't seem to be used
consistently in the book I am reading. Can anyone give two good definitions?
Both with respect to controls.


Nov 16 '05 #8
The terms attribute and property are related in that, in the design phase of
a project, you define attributes of objects - for instance, an attribute of a
car is its color. When you create a car class, you then create a color
property to describe that attribute. It is this relationship that it sounds
like, to me, that you may be getting confused about from your book.

I say this, because there's another attribute definition which is different
enough from a property that it shouldn't be as confusing - the
System.Attribut e class and objects created from that class. You can read the
values of attributes in code and respond appropriately.

In Visual Studio .Net, there is an attribute class. Attributes are placed
into your source code to describe code or control compiler behavior.

"Patrick *" wrote:
Reading a book on .ASP .NET I am getting a bit mixed up as to the difference
between "property" and "attribute" as the terms don't seem to be used
consistently in the book I am reading. Can anyone give two good definitions?
Both with respect to controls.



Nov 16 '05 #9
I think Lasse's post is probably closest to the answer you are looking for,
since you are speaking about ASP.Net.

Attributes belong to Html Elements, such as the table tag. They are
contained inside the opening tag and specifiy behaviors and look and feel
information, like Cellspacing.

Properties belong to controls, components, and classes.

Both serve the same purpose in the grand scheme of things. It's a matter of
convention for the type of language or technology you are dealing with.

"Patrick *" wrote:
Reading a book on .ASP .NET I am getting a bit mixed up as to the difference
between "property" and "attribute" as the terms don't seem to be used
consistently in the book I am reading. Can anyone give two good definitions?
Both with respect to controls.


Nov 16 '05 #10

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

Similar topics

0
2201
by: Nigel Sampson | last post by:
ey all, I'm in the process of creating a method of tracking whenever an objects properties are changed. Since its not possible to alter existing types I decided to used a proxy generated using Reflection.Emit which inherits from the object needed Person p = (Person)ProxyBuilder.Construct(typeof(Person));
5
3869
by: WindAndWaves | last post by:
Greetings once more, I was wondering if someone figured out the difference between attributes and properties. I noticed that things like fields have a number of properties, but also attributes. For example, right now, I am looking for the rowsource property for a field in a table. How do I find that?
12
5805
by: Pol Bawin | last post by:
Hi All, Did somebody already define attributes for numerical properties to define value : minima, maxima, a number of decimal, ...? This information would be useful to unify syntax Polo
1
1621
by: 2G | last post by:
Hi, I have a usercontrol with a custom propertie but in the designer, the properties doesn't expand it's properties so I can't change them. I've search google on this and came across things like DesignerSerializationVisibilityAttribute and Type/ReferenceConverters but can't find a good example on how to actually do this and don't know if this is what I need. Also, after it is possible to change the property in the designer, will the...
3
5079
by: Martin Montgomery | last post by:
I have, for example, a property called myProperty. I would like, when using a property grid to display the property name as "My Property". Is this possible. Is there an attribute etc Thank Martin
2
3186
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
4
1703
by: Thorsten Viel | last post by:
Hi, after searching and testing for hours, im off with that. Maybe you have a snippet or link for me. I have a class with properties. Some of the properties (not all) have a custom attribute. Now i want to call a method which prints out the values of the properties with the custom attributes, and only these values.
5
2576
by: Jon Pope | last post by:
I've got a class which contains properties. I can supply this class to the Properties control, and it will properly display the properties and allow the user to edit them, etc. I would like to be able to programmatically control at runtime which properties are displayed. I've looked at the System.Windows.Forms.Design.ControlDesigner, and specifically looked at the PreFilterProperties() override, but that seems to only work for...
17
2789
by: David C. Ullrich | last post by:
Having a hard time phrasing this in the form of a question... The other day I saw a thread where someone asked about overrideable properties and nobody offered the advice that properties are Bad. So maybe we've got over that. I suppose properties could have Bad consequences if a user doesn't know they exist and think that a certain property of an object is just an ordinary attribute. But that applies to
0
9593
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
10595
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
10335
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
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
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
5529
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
4306
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

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.