I have created my first Webpart with own properties:
[ToolboxItemAttribute(false)]
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);
else
Response.Redirect(parent.Hyperlink);
}
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!