Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie question on attributes

Status
Not open for further replies.

Craftor

Programmer
Feb 1, 2001
420
NZ
Hi all

I've been trying to create a custom attribute for a control on my form from some stuff in the MSDN code. I want to assign several custom attributes to it and the code states I should type the following:

Code:
private string xsltUrl;
[
Browsable(true),
Description("A relative url of the XSLT to apply to the XML"),
Category("Data"),
DefaultValue("")
]
public string XsltUrl {
    get
    {
        return this.xsltUrl;
    }
    set
    {
        this.xsltUrl = value;
    }
}

I get build errors telling me that 'each of the custom properties' could not be found (are you missing a using directive or an assembly reference?) e.g. The type or namespace name 'Description' could not be found (are you missing a using directive or an assembly reference?).

I've read up a bit in MSDN and it looks like I'm going to have to create an Attribute class (from System.Attribute). Is this right? Or is there something I'm missing here?

I have the following namespaces declared:
Code:
using System;
using System.Xml;
using System.Xml.Xsl;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

Thanks as always

Craftor

:cool:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top