Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataColumn property
Message
De
13/12/2003 11:46:08
 
 
À
12/12/2003 13:00:10
Gerald Caussade
Department Mental Health - Missouri
Farmington, Missouri, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00857952
Message ID:
00858911
Vues:
24
Jerry,

I messed with this a bit this morning and I see what you're talking about when you say that the DataColumnP property stays null. I'm sure there's another way around this, but here's what I did to get it to work.

You're actually after the ColumnName, but you're using a DataColumn because you want to be able to pick a column from the Property Sheet, correct? What I did was create another Property, call it MyColumnName, and in the set of your DataColumnP property, set like this:
private DataColumn _dc;
private string _name;

public DataColumn DataColumnP
{
  get {return _dc;}
  set 
  {
    this._dc = value;
    this._name = value.ColumnName;
  }
}
public string MyColumnName
{
  get {return _name;}
  set {this._name = value;}
}
Then use either _name or MyColumnName in your DataBinding. The main reason for making MyColumnName a property is just so it will show up on the PropertySheet, so you have some feedback that you actually picked a column, since it doesn't show up under DataColumnP unless you expand the +. Should work like a charm.

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform