Geeks With Blogs

Tangible Thoughts SharePoint, MOSS? and all the other questions

/// <summary>
/// Gets or sets the site URL.
/// </summary>
/// <value>The site URL.</value>
WebDescription("Url of the site to process reports on"),
WebDisplayName("Site Url"),
public string SiteUrl
        if (string.IsNullOrEmpty(siteUrl))
            return SPContext.Current.Web.Url;
        return siteUrl;
        siteUrl = value;


The above code snippet looks like  a  reasonable WebPart Propperty. In-fact you will find nothing weird with it untill you provision this webpart through a feature.

What happens is the reference to the SPContext…. in the property messes up the WebPart Order on the page and moves the webpart to Order 1 (i.e. first webpart on the zone), no matter what other preference you would have set in your feature.

Interesting eh? Something to keep in mind for future

Crossposted from

Posted on Thursday, October 15, 2009 12:00 PM SharePoint | Back to top

Comments on this post: Whats wrong with this code?

# re: Whats wrong with this code?
Requesting Gravatar...
nice sharing thanks.
Left by kenan on Jan 15, 2010 5:16 AM

# re: Whats wrong with this code?
Requesting Gravatar...
Peter this side from Canada. What this is all about? Can someone clarify this to me?

Left by Peter on Apr 01, 2010 4:15 PM

Your comment:
 (will show your gravatar)

Copyright © Tariq | Powered by: