I created an webpart, and I've added a custom property. The webpart works fine.

Now I want to add this webpart in another page also, but with a different property value. The problem is that if I set the property value it will update all the values in all the webparts of this type in my site.

What should I do?

Here is my code:

public class ListWebPart : WebPart
    public static string List;
    [Category("Extended Settings"),
    WebDescription("Please Enter a Sample List"),


PS: Shorty scenario If you add a web part in page 1 and set the title: Webpartbla than you add the same web part in another page and set the title: webpartbla1 it will remember this values of the same webpart in different pages. This won't work with custom properties, like the one above

1 Answer 1


Don't make property List static


Working code:

public class MyDetailWebPart : WebPart {
  public string Code { get; set; }
  protected override void CreateChildControls()
        var control = (MyControl)Page.LoadControl(_ascxPath);
        control.Code = Code;

public partial class MyControl : UserControl
  public string Code { get; set; }

Your Answer

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

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