Tag Info

Hot answers tagged

8

I hope this can help you, althought I have not tested it. You can find an example here: http://www.sharepoint-tips.com/2010/06/validating-web-part-properties.html private string _webPartContentLink = null; [Personalizable(PersonalizationScope.Shared)] [WebBrowsable(true)] [System.ComponentModel.Category("Services")] ...


7

It is not safe to store credentials, connectionstrings or similar in web parts. All users with contributor (designer in SP2010) settings and upward can export the web part and fetch the values from the .webpart/.dwp xml. You can set the web part to not allow export, or not to export sensitive data (sensitive data is set on using the IsSensitive parameter ...


5

you could create a custom EditorPart which creates a custom interface in which you verify the input. Check this out: Web Part Properties - part 2 - Editor Parts


4

You will need to add a ID to your ToolPart (EditorPart). For example: public MyEditorPart(string webPartID) { this.ID = "MyEditorPart" + webPartID; } http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?List=70640fe5-28d9-464f-b1c9-91e07c8f7e47&ID=36


3

As far as i remember setting properties requires Designer permissions in SP2010 (due to Fear of XSS). This might explain the behaviour you are seeing. You may also need to switch: [Microsoft.SharePoint.WebPartPages.WebPart.WebPartStorage(Storage.Personal)] for the newer: [System.Web.UI.WebControls.WebParts.Personalizable(PersonalizationScope.User)]


3

On load. But that may not be a bad thing. You didn't provide many details about your requirements, so hard to say for sure. If the property depends on something that may change external to the web part, then you probably should leave it there so that only valid values are restored when the page is loaded. However, if the validation only applies when the ...


3

Your IVersioningPersonalizable code looks right, but I think SharePoint determines unknown properties by their name, and if property was not renamed - it will not be unknown... So, could you please rename YSeriesType property and try to perform the upgrade again?


3

Abe you said: I downloaded the source but it only appears to work with the static drop down list of items. I followed your instructions but was never able to get the drop down working with an internal list. Is this possible to do by following the instructions you have provided? If so, would it be possible to get you to post up the working ...


2

In addition to what Wictor said, remember to define your own ValidationGroup when you are using custom or out of the box ASP.NET validators, that way you dont get interference from other validation controls that might be on the same page when you do a post back (maybe a subject for your book Wictor?:-)


2

I have a custom ToolPart that reads from a database, but you could change it to read from a SPList instead public class CustomToolPart : ToolPart { protected override void CreateChildControls() { ddlCustom = new DropDownList(); ddlCustom.ID = "ddlCustom"; ddlCustom.ToolTip = "Custom"; try { using ...


2

This purely depends on where in the life cycle of the Web Part you use the properties. If you use the values early before the "ToolPane" gets the clicked event for Apply/OK which causes your ToolParts ApplyChanges to fire and change the properties, well then the changes wont show up until next pageload. If you use the values late (after the clicked event) ...


1

Enums in .Net can have spaces with System.ComponentModel.DescriptionAttribute. Your example could be rewritten like this: public enum Group { [Description("John Doe's Group")] GroupA, [Description("Frank Star's Group")] GroupB, [Description("Stella Reinolds Group")] GroupC } Then using reflection you could access Description ...


1

I guess using a webpart toolpart will accomplish this. Two links I found by just googling "webpart toolpart": http://msdn.microsoft.com/en-us/library/dd584178(v=office.11).aspx https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/SharePoint-Creating-a-Custom-ToolPart-for-a-Custom-Web-Part.aspx


1

This article from Microsoft describes exactly how to use web part properties: http://msdn.microsoft.com/en-us/library/dd584174(v=office.11).aspx Basically, you mark (decorate) a c# Property in your code as follow: [Personalizable(PersonalizationScope.Shared)] [WebBrowsable(true)] [System.ComponentModel.Category("MyCategory")] [WebDisplayName("Display ...


1

Christan, There are no out-of-the-box editorparts that display multilines or anything that have been tailored to your specific needs. The correct way of doing this is to use a custom EditorPart/ToolPart. Technically, you could probably hack something together with jQuery, but I'll leave to others to explain how to do that. In any case, it would be more ...


1

It happens on every load. The WebPartManager creates your web part using the default constructor and then applies all the stored values of properties. There really isn't any other way it can do it. The only information it has is the Property and the value, only your code knows how/where if the value is assigned to members internally. As Paul writes if you ...


1

In addition to Anders' answer, I also had to change the SafeAgainstScript attribute in the SafeControl entry for the web part to True, in order for Contributors to be able to change the property. As an interesting side-effect, those with the Designer role now all share the Shared version of the property. Whereas all normal users have their own personalised ...


1

You can open the page in edit mode by appending ?mode=edit, but you cannot specify which web part to show the tool pane for.


1

The error message is referring to the class DataSeries1, which is being used by the existing webpart. So, I'm guessing that you deleted (or renamed) this class. After executing the code that updates the property values, then you can safely remove your DataSeries1 class.


1

Check out the following article: https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/SharePoint-Web-Parts-with-jQuery-and-the-Web-ToolPart.aspx



Only top voted, non community-wiki answers of a minimum length are eligible