SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a webpart with several properties that are part of a custom ToolPart. When i set the properties i would like the webpart to reflect the property changes while still editing after having clicked Apply/Ok but the page is still in Edit mode (i'm guessing in the ApplyChanges of my custom tool part). Any ideas?


share|improve this question
After you make the changes , click on OK instead of Apply and close the edit mode page. Now save the page and browse back again and let me know the changes are getting reflected or not. – Arko D May 31 '12 at 17:25
That works....i was wondering, however, if there was a way to re-render the webpart with the changed properties while still in edit mode after hitting Apply. I was thinking that there might be a way in the ApplyChanges method – MikeC May 31 '12 at 17:35
up vote 2 down vote accepted

This purely depends on where in the life cycle of the Web Part you use the properties.

If you use the values early before the "ToolPane" gets the clicked event for Apply/OK which causes your ToolParts ApplyChanges to fire and change the properties, well then the changes wont show up until next pageload.

If you use the values late (after the clicked event) then the change will show up "immedately".

In my advanced web part below changes to TestCCC will not show until next pageload because I call EnsureChildControls in PageLoad which the adds the LiteralControl before the clicked event. Changes to TestRC which is will show immediately because it's rendered out late.

public class TestEditWP : WebPart
    public string TestCCC { get; set; }

    public string TestRC { get; set; }

    protected override void OnLoad(EventArgs e)
    protected override void CreateChildControls()
        Controls.Add(new LiteralControl(TestCCC));

    protected override void RenderContents(HtmlTextWriter writer)
        writer.Write("{0}", TestRC);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.