Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Webpart - Custom Editor

  Asked By: Mital Palan         Date: May 23, 2009      Category: Sharepoint      Views: 262
 

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
fine.

Could you please advice me to resolve this error??

Tagged:      

 

3 Answers Found

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

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, 2009       

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, 2009       

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 =
NewWhoWeare_EditorWebPart"_EditorPart"editorParts.Add(editorPart)Dimbaseparts
AsEditorPartCollection =
MyBase.CreateEditorParts()ReturnNewEditorPartCollection(baseparts,
editorParts)EndFunctionPublicOverridesReadOnlyPropertyWebBrowsableObject()
AsObjectGetReturnMyBase.WebBrowsableObjectEndGetEndPropertyEndClass

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

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


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].