1

I have my Tool Part class to handle the properties of my Web Part. My method to create the properties( CreateChildControls ) is working fine but everytime I run this method it's reading a parameter from a previous postback.

So when I click to apply the changes..

public override void ApplyChanges()
    {
        EnsureChildControls();
        WebPart1 wp = (WebPart1 )this.ParentToolPane.SelectedWebPart;
        wp.test = paramet.Text;
    }

It's supposed to read the current value of "paramet.Text" right? No..instead of this, it will call CreateChildControls again, this time my variable from a previous postBack doesn't exist, so no values for my "paramet.Text".

Is this the expected behaviour for ApplyChanges? Because this way..my properties will never be saved.

7
  • Why do you call EnsureChildControls? I've followes this example with great success: nothingbutsharepoint.com/sites/devwiki/articles/Pages/… Sep 19, 2013 at 12:26
  • just to make sure the child controls are being created. Thanks for the link. I'll have a look at it and I'll say something soon!
    – nhenrique
    Sep 19, 2013 at 12:45
  • it worked. But I need something different here...Instead of ( this.ddColor.SelectedValue = wp.pColor; ) I'm checking if a variable exists, and if it does, I want to assign instead of wp.pColor. But it doesn't seem to take any effect, with a variable or a regular string..
    – nhenrique
    Sep 19, 2013 at 13:44
  • @RobertLindgren The like you provide is broken link. can you provide me solution for this. May 5, 2014 at 11:11
  • @VigneshKumar I think it is jut temp. down, but here is a similar link :waelmohamed.wordpress.com/2010/03/14/… May 5, 2014 at 11:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.