tags:

views:

35

answers:

1

Hi,

I have a custom webpart and when it first renders I want to give link to open modify shared webpart properties as we generally get when we open OOB webparts like Content editor or XML webpart? Any one is having idea on this ...I was using this but when I m clicking on it, its showing following error

I m using this:

LiteralControl lctrl = new LiteralControl();
lctrl.Text=string.Format("<a id='MsoFrameworkToolpartDefmsg_{0}' href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit','129','{0}');\">Open the tool pane</a> and enter a valid value.",this.ID);
Controls.Add(lctrl);

ERROR: A Web Part you attempted to change is either invalid or has been removed by another user.Click to refresh it.(This its showing in my toolpane)

+1  A: 

Taken from a working webpart:

myvar = "<a href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit', this, '" + ID + "')\">Open the toolpanel</a>"

"ID" is the webpart ID. I use a UserControl to hold my WebPart code, so I use Parent.ID

F.Aquino
thanks for the reply ...I am also using usercontrol wrapped in webpart so I should change ID with my ParentID of webpart u mean?
TSSS22
try Parent.ID to get the WebPart ID (not the UserControl's)
F.Aquino
its working perfectly...Thanks!!!
TSSS22