Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Postback Lifecycle Issue with MenuItem Captions

  Asked By: Keon    Date: Nov 27    Category: Sharepoint    Views: 1281

I want to use a custom property to set the caption for a Web Part
MenuItem. Of course, the new value for the custom property is not
available in the CreateWebPartMenu method so I need to set the MenuItem
caption in RenderWebPart. But it seems that the Web Part Menu may be
unalterable in RenderWebPart. The MenuItem I want to set is a custom
one, but setting the caption doesn't even work for altering the built-in

To see what I mean, drop this code at the beginning of your
RenderWebPart method in any existing C# Web Part (before the
base.RenderWebPart() statement):

WebPartMenu.MenuItems.ItemFromID("MSOMenu_Minimize").Caption =
"Altered Minimize Caption";

It simply sets the Minimize caption to a static value. Check out the
_unchanged_ Web Part menu in the browser. This code works fine in the
CreateWebPartMenu method, why not in the RenderWebPart method? Anyone
have any ideas on how to overcome this hairy postback lifecycle problem?



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Postback Lifecycle Issue with MenuItem Captions Or get search suggestion and latest updates.