Bonjour,
J ai un problème les propriétés dans le designer avec un web server control.
Si je fait :
Code :
- Color bgColor = Color.White;
-
- [Category("Appearance" )]
- [Description("The background color" )]
- [DefaultValue(typeof(Color), "0, 0, 0" )]
- public Color BgColor
- {
- get {
- return bgColor;
- }
- set {
- bgColor = value;
- }
- }
|
Dans ce cas ok tout se passe bien je peux choisir la couleur dans le Designer. Mais si j'utilise un ViewState comme ceci:
Code :
- [Category("Appearance" )]
- [Description("The background color" )]
- [DefaultValue(typeof(Color), "0, 0, 0" )]
- public Color BgColor
- {
- get {
- return (Color)ViewState["BgColor"];
- }
- set {
- ViewState["BgColor"] = value;
- }
- }
|
Il ne fonctionne pas et il fait: "Object reference not set to an instance of an object."
Pourquoi et comme résoudre se problème???
D'avance merci
Ben