473,395 Members | 2,783 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,395 software developers and data experts.

Property label

Hi,

I'm using databing with some classes, and I would like to know if
there's a way to define some sort of description Attribute for a property.

I have this Porperty:
public string ItemsInStock{
get { return _ItemsInStock;}
set {_ItemsInStock = value;} }

My problem, when DataBinding in Master or Detail mode, is I have a field
referenced as "ItemsInStock" when I want it to be referenced as "Items
in stock".

I'm expecting something as:
[Databind.Caption("Items in stock")]

TIA
Nov 14 '06 #1
2 955
In .NET 2, after creating a data source and dragging fields over it should
parse them based on Pascal/Camel casing. However, what you need for ultimate
control is the System.ComponentModel.DisplayNameAttribute()

e.g

private int myVar;
[System.ComponentModel.DisplayName("My Renamed Property")]
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
This renames the property for the purposes of data binding and things. Give
it a try.

Ciaran O'Donnell
"Charles Bazi" wrote:
Hi,

I'm using databing with some classes, and I would like to know if
there's a way to define some sort of description Attribute for a property.

I have this Porperty:
public string ItemsInStock{
get { return _ItemsInStock;}
set {_ItemsInStock = value;} }

My problem, when DataBinding in Master or Detail mode, is I have a field
referenced as "ItemsInStock" when I want it to be referenced as "Items
in stock".

I'm expecting something as:
[Databind.Caption("Items in stock")]

TIA
Nov 14 '06 #2
Thank you !

Ciaran O''Donnell wrote:
In .NET 2, after creating a data source and dragging fields over it should
parse them based on Pascal/Camel casing. However, what you need for ultimate
control is the System.ComponentModel.DisplayNameAttribute()

e.g

private int myVar;
[System.ComponentModel.DisplayName("My Renamed Property")]
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
This renames the property for the purposes of data binding and things. Give
it a try.

Ciaran O'Donnell
"Charles Bazi" wrote:
>Hi,

I'm using databing with some classes, and I would like to know if
there's a way to define some sort of description Attribute for a property.

I have this Porperty:
public string ItemsInStock{
get { return _ItemsInStock;}
set {_ItemsInStock = value;} }

My problem, when DataBinding in Master or Detail mode, is I have a field
referenced as "ItemsInStock" when I want it to be referenced as "Items
in stock".

I'm expecting something as:
[Databind.Caption("Items in stock")]

TIA
Nov 14 '06 #3

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

Similar topics

0
by: Colin | last post by:
Hi there, I really need your help on this. I'm trying to learn to using the VS.2003 to create a User Control. In my aspx code has no problem to use the property "grossWaye" that has "register" in...
3
by: Kent Eilers | last post by:
I want to follow naming conventions for my controls - i usually prefix combo boxes with "cbo". When a form is in datasheet view however i do not want the user to see the 'cbo' prefix in front of...
8
by: critter | last post by:
I am trying to get a value of a property of a class, but not an instance of the class. Using Reflection, I can find the class in my assembly, and I can find the property of my class, however, I...
10
by: everett | last post by:
I am dynamically creating labels. I would like to be able to attach custom properties(?) to the labels so that I can query the property for the data in it later. Is this possible, and how do I...
13
by: Bevan Arps | last post by:
I have a simple question, but one to which I haven't (after a whole bunch of Googling) been able to find an answer: Are there any guarantees to the order of PropertyInfo objects returned by a...
8
by: Jordi Rico | last post by:
Hi, I've made the next inherited class in Visual Studio 2005: Public Class LabelEx Inherits System.Windows.Forms.Label Sub New() MyBase.New() Me.ForeColor = Color.Black Me.AutoSize = False...
1
by: suki | last post by:
How can i set the data binding property of an label to a field of a dataset (defined in a class in my project) ? In this data field, there are many entries and i want to have as much labels as...
1
by: Steve Hershoff | last post by:
I'm using VS 2003, and need to extract the text from an asp label in my code-behind file. The label is part of a DataList's ItemTemplate. I've noticed that in my ascx file (we're using User...
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
0
missinglinq
by: missinglinq | last post by:
Having been asked, for the umpteenth time, how to use the MouseMove property to change the appearance of an object, I put together this short tutorial and sample database today. Perhaps it will be of...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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,...

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.