Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Webpart - Custom Editor

  Asked By: Mital    Date: May 23    Category: Sharepoint    Views: 1287

I recently attended the Mindsharp classes at Newyork, I have problem in
adding Custom editor.

I developed custom webpart which contains one custom property of type
string . I have created a custom editor to updates the value of Webpart
custom property. After adding the webpart to a page, If I click on
"OK" /"Apply" on editing pane, I get anerror "Can not save the
Property settings for this webpart. An error has occurred"

P.S: If I edit the webpart property without custome editor, it works

Could you please advice me to resolve this error??



3 Answers Found

Answer #1    Answered By: Candy Walter     Answered On: May 23

Can you share the code you used to define the property  itself and the
ApplyChanges method for the Custom Editor. The ApplyChanges method should be
where the problem  lies.

Answer #2    Answered By: Leanne Rios     Answered On: May 23

There wasn't any more information than that? Most problems like this can be
solved by placing the call in a try catch block and then use remote
debugging to get more information from the exception. Another way would be
to crank up the logging in sharepoint and/or turn on the stack
trace/detailed error  messages. Could it be a permissions related issue with
CAS or user account permissions?

Answer #3    Answered By: Zachary Roberts     Answered On: May 23

Here is the code that used for defining the property  and ApplyChanges method
# Property
Private_ListnameWp AsString= "whoweare_ITS"<WebPartStorage(Storage.Shared)>
_PublicPropertyListname_whoweare() AsStringGetReturn_ListnameWpEndGet_ListnameWp
= valueSet(ByValvalue AsString)EndSet
# Overrides EditorPublic
editorPart.ID = ID + OverloadsOverridesFunctionCreateEditorParts()
AsEditorPartCollectionDimeditorParts AsNewList(OfEditorPart)DimeditorPart
AsEditorPart =
AsEditorPartCollection =

#Apply changes in EditorPartPublicOverridesFunctionApplyChanges()
AsBooleanEnsureChildControls()DimwebPartE AsWhoWeareWebpart =
TryCast(WebPartToEdit, WhoWeareWebpart)IfNotwebPartE
IsNothingThenTrywebPartE.Listname_whoweare. = _listName.Text.ToString
_ErrorMessage = ex.Message.ToStringCatchex AsExceptionEndTryEndIfEndFunction

Didn't find what you were looking for? Find more on Webpart - Custom Editor Or get search suggestion and latest updates.