Tangible Thoughts

SharePoint, MOSS? and all the other questions

  Home  |   Contact  |   Syndication    |   Login
  858 Posts | 6 Stories | 475 Comments | 2088 Trackbacks

News

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Linky Things

SharePoint Bloggers

SharePoint Related

What I am playing

What I am Reading

[code]

/// <summary>
/// Gets or sets the site URL.
/// </summary>
/// <value>The site URL.</value>
[WebBrowsable(true),
WebDescription("Url of the site to process reports on"),
WebDisplayName("Site Url"),
Personalizable(PersonalizationScope.Shared)]
public string SiteUrl
{
    get
    {
        if (string.IsNullOrEmpty(siteUrl))
        {
            return SPContext.Current.Web.Url;
        }
        return siteUrl;
    }
    set
    {
        siteUrl = value;
    }
}


[/code]

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 tariqayad.com

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Thursday, October 15, 2009 12:00 PM

Feedback

# re: Whats wrong with this code? 1/15/2010 5:16 AM kenan
nice sharing thanks.

# re: Whats wrong with this code? 4/1/2010 4:15 PM Peter
Hi,
Peter this side from Canada. What this is all about? Can someone clarify this to me?

Thanks
Peter
[url=http://www.candy.com/]Candies[/url]


Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: