Welcome to Atlanta .NET Regular Guys Sign in | Join | Help

SharePoint 2007 - Web Part Property Categorization (or lack of)

I am currently working on a web part for a client.  The web part is pretty simple "looking" but does a lot under the covers.  I have built in validation, not only input validation but also database checks based on the input on the form and the user's identity using some SQL calls.  If all of this succeeds, I am accessing the Reporting Services web services to stream a report to the user, otherwise, displaying an error message.

The web part requires plenty of configuration, such as customizable detailed error messages, labels, button, copy, report name and location, report format, and more.  I will have roughly 12-15 properties by the time I am done (if of course the client doesn't ask for more).

Back in WSS v2 we had an attribute that looked like this (in red):

private string reportPath = "";

[Browsable(true),

 Category("Reporting Services"),

 DefaultValue(""),

 WebPartStorage(Storage.Shared),

 FriendlyName("Report Path"),

 Description("The full Url path to the report in Reporting Services")]

public string ReportPath()

{

    get

    {

        return reportPath;

    }

    set

    {

        reportPath = value;

    }

}

In WSS v3, the list of attributes is a little different.  We have something that looks like this:

private string reportPath = "";

[WebBrowsable(true),

 Personalizable(PersonalizationScope.Shared),

 WebDisplayName("Report Path"),

 WebDescription("The full Url path to the report in Reporting Services")]

public string ReportPath()

{

    get

    {

        return reportPath;

    }

    set

    {

        reportPath = value;

    }

}

I can't seem to locate any other attributes.  Does this mean that the ASP.NET team has removed them?  Can I no longer categorize my custom properties?  Why can the SharePoint team use categories but not us?  Also, I could not locate the default value attribute.  There are other ways to set this in v3, namely in the .webpart xml file, or elsewhere in the code, but why remove perfectly good bits of functionality?  They were just a couple of attributes.

I would love to hear your thoughts on this if you have a possible solution to the categorization issue,  I would rather not have all of my custom properties show up under miscellaneous.

Maybe I am just not looking hard enough.

[EDIT - 11/10/2006]

I found it!

Just add the good old ComponentModel Attribute like so:

[Personalizable(PersonalizationScope.Shared),
WebBrowsable(true),
System.ComponentModel.Category("Reporting Services"),
WebDisplayName("Domain"),
WebDescription("The preceding user's domain.")]
public string SSRSDomain
{
    get { return _SSRSDomain; }
    set { _SSRSDomain = value; }
}

This puts the properties into a collapsible node, like so:

that when expanded looks like this:

I knew it had to be somewhere!

Published Sunday, October 29, 2006 5:43 PM by Dan Attis

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# SharePoint 2007 - The missing attribute is found

Read my updated post on the categorization of web part properties.  Turns out it was there all along,...
Monday, November 13, 2006 6:54 AM by Dan Attis

# SharePoint 2007 - The missing attribute is found

Read my updated post on the categorization of web part properties.  Turns out it was there all along,...
Monday, November 13, 2006 6:23 PM by Dan Attis

# re: SharePoint 2007 - Web Part Property Categorization (or lack of)

Nice one! You just saved me from near topping myself over this one, cheers!!
Tuesday, December 12, 2006 7:10 AM by Ian

# re: SharePoint 2007 - Web Part Property Categorization (or lack of)

There is attribute called SPWebCategoryName that will group the web part properties like the old v2 Category does.
Sunday, August 19, 2007 8:34 PM by David

# re: SharePoint 2007 - Web Part Property Categorization (or lack of)

System.ComponentModule.Category? Man, I would have NEVER thought to use that!

Thank you a million times over! You Rock!
Thursday, September 13, 2007 11:56 AM by JimShelley

What do you think?

(required) 
required 
(required)