Question

I have written a web part that has 3 extra properties that are all related. Right now each has its own title & input field. Is there a way I could make it 1 title with 3 fields?

I was not successful when using a struct for the field.

 Public enum joinType{
       And=0,
       Or
 }

 [WebBrowsable(true), Category("custom"), WebDisplayName("Choice : Part 1"), WebDescription("Title of object"), PersonalizationScope(PersonalizationScope.Shared)]
 Public string myTitle {get; set;}

 [WebBrowsable(true), Category("custom"), WebDisplayName("Choice : Part 2"), WebDescription("Type of object"), PersonalizationScope(PersonalizationScope.Shared)]
 Public joinType myType {get; set;}

 [WebBrowsable(true), Category("custom"), WebDisplayName("Choice : Part 3"), WebDescription("Value of object"), PersonalizationScope(PersonalizationScope.Shared)]
 Public string myTitle {get; set;}
Was it helpful?

Solution

You can do that by making all of these webbrowseable(false) and creating your own editorpart which looks however you want and then when you save the editor part you can assign the webpart properties the appropriate values from your editorpart.

See http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.editorpart.aspx and http://msdn.microsoft.com/en-us/library/hh228018(v=office.14).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top