Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created my first Webpart with own properties:

public class BildMitHyperlink : WebPart
    [WebBrowsable(true), Category("MY"), DefaultValue(""), WebDisplayName("Hyperlink"), WebDescription("Der Hyperlink der gestartet werden soll, sobald auf das Bild geklickt wird.")]
    public string Hyperlink
        get { return _hyperlink; }
        set { _hyperlink = value; }
    public static string _hyperlink;

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        var parent = (BildMitHyperlink)Parent;

        if (parent.NeuesFenster)
            Response.Redirect(parent.Hyperlink, "_blank", null);

My Problem is: When i create more then one WebPart on the same Page, the properties are shared on each WebPart! So if i change a propertie of one of the webparts - its change all my webparts?!

How can i make own properties for each Webpart?

Thanks 4 Answer!

share|improve this question
Ahh! Thats it! Thanks 4 your fast answer and help! –  user9454 Jul 13 '12 at 10:04
No prob, if it works for you, feel free to mark it as 'Answered' –  Andy Burns Jul 13 '12 at 10:13

1 Answer 1

I would suggest that the _hyperlink variable should not be static. All the web parts of this type share the same C# class, so setting _hyperlink would reset that variable for all those web parts.

It probably shouldn't be public, either, as you've provided a property to access it.

share|improve this answer
Example of a properly implemented web part property:… –  Kit Menke Jul 13 '12 at 16:01

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.