How to change a web part’s behaviour when a page is in edit mode

WebPartManager wpm = WebPartManager.GetCurrentWebPartManager(this.Page);

if (wpm.DisplayMode.AllowPageDesign)
this.Controls.Add(new Literal(“edit mode”));
this.Controls.Add(new Literal(“not edit mode”));

Thanks to I was able to use this to allow a user to append a querystring on to the URL to prevent a redirect.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s