locked
Store Original Site URL in Published WebPart RRS feed

  • Question

  • I am trying to store the current web URL as a property in a custom WebPart. It stores the value fine, but when the site is published it changes the stored URL to the published site url. Is there a way to prevent the URL from changing to the published site and remain the original staging URL?

    Thanks.
    Thursday, October 29, 2009 1:51 PM

Answers

  • Hi Ryles,

    In custom webpart property use C# logic in "set" section to prevent overwrite.

    Example

    string _url;
    public string URL
    {
    get 
    return _url; 
    }

    set 
    if(_url == null)
       _url = value; 
    }

    }


    Hope it helps !

    Regards
    B
    • Marked as answer by Chengyi Wu Wednesday, November 4, 2009 1:54 AM
    Friday, October 30, 2009 10:58 AM