Hot answers tagged

11

AFAIK, DefaultValue attribute won't work for webpart properties. You can use .webpart file for setting default values to your properties. You will need to add new <property> element under <properties> tag, like following: <property name="sectionToRead" type="string">CV</property>


9

Your SelectedTabs property should be persisted. Try use this code: [Personalizable(PersonalizationScope.Shared), WebBrowsable(false)] public List<ListItem> SelectedTabs { get; set; } Update: Also, you should not store ListItem's. I changed List<ListItem> to List<string> and fixed some code, and it is working on my machine now. Here is ...


8

Definitely passing webpart values to XSLT is possible for all classes which inherit from DataFormWebPart, and can be easily done through ParameterBinding: <ParameterBinding Name="WPPropertyBinding" Location="WPProperty(Title)" /> Use your custom property name instead of Title. If you're using a standard SummaryLinkWebPart and you need only to fix ...


7

This is common error if you eg. changed WebPart name after creation and/or changed its namespace. Since you are working on SharePoint 2010 and most likely with Visual Studio 2010 in VS project: Select your custom webpart Use right click > Properties In properties windows under SharePoint find Safe Control Entries Click ... button Verify your settings ...


5

I use code snippets for this kind of thing. How to create a code snippet How to Manage Code Snippets Here is an example string property you can invoke by wpptabtab. Then you tab through the parts to fill out: <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> ...


5

Check out Marc Anderson's SPServices library, there is a cascading drop down operation. You could also achieve that functionality through InfoPath forms, but not in the web enabled forms I believe.


4

You need to load webpart properties before you can read them. That is, var properties = webPart.get_properties(); currentCtx.load(properties); Then read the properties in success method. currentCtx.executeQueryAsync(...


3

Try opening your page in web part management mode by adding ?contents=1 to the end of your url If your webpart page URL is http://myportal/pages/default.aspx Browse to http://myportal/pages/default.aspx?contents=1 This will list all webparts, and allow you to delete some of them. By the way, how many webparts do you have per zone and in total?


3

Watch out as SummaryLinkWebPart is a sealed class - you can't inherit it. Basically you'd have to build it from scratch.


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

The /_layouts/userdisp.aspx page which is linked from "user hyperlinks" contains the following control: <SharePoint:DelegateControl runat="server" id="DelctlProfileRedirection" ControlId="ProfileRedirection" Scope="Farm" /> I believe that when you have MySites enabled it will load a child control that redirects a user to that user's profile on the ...


3

Your code should look like below, its a base class that the webpart calls.... in the base class im setting the webpart settings, Iv made a custom one for you where you will see it in the properties of the webpart when you edit the webpart. private const string c_YourCustomVairable = ""; public BaseWebPart() { _YourCustomVairable= ...


2

Here is an example of delegate control, that redirects request. This solution for sharepoint 2007, but it can be still applicable for 2010 version.


2

I think it's part of the PageLayout , when the Page is in EditMode it displays all the different zones.


2

If you are doing a postback, you need update the values of your controls in your SyncChanges() method implementation. UPDATE: I think part of the confusion here is that the Editor part is a control, not a page or usercontrol, and further it has some very specific requirements/behavior. You are creating all the controls programmatically, and you need to ...


2

To access SP.WebParts.WebPart Properties it need to be requested explicitly. In your example you could change the expression at the line: currentCtx.load(webPartDefs, 'Include(WebPart)'); with currentCtx.load(webPartDefs, 'Include(WebPart.Properties)'); Modified example var currentCtx = SP.ClientContext.get_current(); var pageFile = ...


2

Create the property as a dropdown box and the Personalization scope should be PersonalizationScope.User. Sample code might look like below. public enum UserColor { Blue = Blue, Green = Green, Yellow = Yellow } private ItemCount uColor= UserColor.Blue; ...


2

SharePoint badly displays the properties of type bool, I do not know why. The workaround is to change the type of properties for enum. public enum yesNo { Yes, No } [Category("Miscellaneous")] [Personalizable(PersonalizationScope.Shared)] [WebBrowsable(true)] [WebDisplayName("Option1")] ...


1

You can incorporate TaxonomyWebTaggingControl in your Web Part and bind it with a Tersmset during the run-time: More info: http://www.vesoftware.in/2012/04/add-taxonomy-field-taxonomywebtaggingco.html


1

You can use jQuery (or even plain JavaScript) to get the attribute from the generated for the wev part. The only thing you'd need is somethint that allows you to identify this Web Part even from within the main container. If you own the code for the WP, you can add a custom div with and ID or a class (or data-something), get that using jQuery and then ...


1

Mallu, This can be achieved by creating Editorpart for your custom web part. Lets say the web part that we are building is RightNav.ascx Create a .CS file under your web part (.ascx) Full code of the EditorPart.cs is as follows You may have to edit the code as per your requirements class RightNavEditorPart : EditorPart { ...


1

It seems [ToolboxItemAttribute(false)] is missing on your partial class. Also ordering may be a issue but I am not sure about that. I am giving you a fully functional code snippet where I implemented webpart custom properties. Please update your code as per my below code. Let me know whether it works or not. using System; using System.ComponentModel; using ...


1

Develop the code as described by @Deepu. When you add the web part to a WebPart Page (NOT a wiki page) the users have the option of going to the hidden personal menu and select Personalize this Page and then edit the web part. The only properties they can edit in this mode are the User scoped ones and they only modify them in their personalized view


1

This sounds like it could be classed as configuration data. This msdn article - Managing Application Configuration - describes the options available to you. Basically you can store the properties in either: web.config hierarchical object store property bag list I'd therefore recommend a list which is secured so only certain people can access it. ...


1

Do you have viewstate turned on? When are these controls created, in createchildcontrols? Are you adding them to the controls collection? Are you storing the value of this dropdown list in a webpart property? Are you setting the selectedindex after creating the control? It would help you posted your editorpart code. Update: Where is the code for the ...


1

You will need to make a copy of this page and edit that on the filesystem. As you say, it is a bad idea to modify an OOB page as it will probably get overwritten when you upgrade to the next version or apply a service pack. You may also lose functionality in future versions. Ideally, you should deploy your application page using a feature, so that you can ...


1

I assume you are talking about a custom editorpart (toolpanepart). I've done this before using dropdownlist controls and implementing icallbackeventhandler to ajax load the cascading dropdowns. The only gotcha I ran into was a pagevalidation error. I got around that by using the Page.ClientScript.RegisterForEventValidation for my new values of the ...


1

I think you have complicated your solution :) Firstly, btnSubmitZipCode_Click will get executed after Page_Load. there is no need to use the "ParentWebPart" property. If you want remove the ability to change the option in "Edit Webpart" you don't need the property pZipCode. Simple solution would be : Seperate the Webservice call which might include ...


1

I have a brief description of how to the user can update the nested web part with the default properties editor here. Basically, you would write something like this in your code-behind: oWebPart.Height = this.Height oWebPart.Width = this.Width That way, your nested page viewer web part will inherit what the user typed. The page viewer web part is ...


1

The Client OM has features in place to interact with the Notification messages and Status bar. Check out the SP.UI namespace. Here is the documentation on MSDN with an example: http://msdn.microsoft.com/en-us/library/ee658473.aspx Here are some other Client OM related examples on my blog for the Status bar and ModalDialog box. ...



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