Sunday, August 19, 2012

configuring a web part

here's the tip for today.... You know how when you add an out-of-the-box web part that requires configuration you get a nice little message in the web part display that you need to configure it, and a link to open up the toolpane? Add a Page Viewer web part to your site and you'll see what I mean.... Well here's how to add one of those links. This is really useful in exception handling for configuration related exceptions too....
In your RenderWebPart override check to see if your part is configured, if not output something like this:
output.Write(@"Web Part not configured: <a target=""_self"" href=""javascript:MSOTlPn_ShowToolPaneWrapper('1','129','g_" + this.StorageKey.ToString.Replace("-"c, "_"c) + @"');"" target=""_self"">click here</a> to configure<br>");

No comments:

Followers

No Locks without Key

🌿 Bible Verse 1 Corinthians 10:13 "No temptation has overtaken you except what is common to mankind. And God is faithful; ...

Who Am I?

My photo
What is mankind that you are mindful of them, human beings that you care for them? Psalms 8:4 But he made us a little lower than Angels and Crowned with Glory and Honor. How majestic is your name in all the Earth Oh Lord our God!