Tag Info

Hot answers tagged

8

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>


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


8

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


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.


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


4

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


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

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


3

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


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?


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

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


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

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

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

See if this works: public override EditorPartCollection CreateEditorParts() { var zoneEditor = new ZoneEditor { ID = ID + "_Editor", Title = "Time Zone Editor" }; var editor = new ClockEditor { ID = ID + "_Editor", Title = "Custom Clock Editor" }; return new EditorPartCollection(new EditorPart[] { ...


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

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

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

It's easy - you need to get your webpart from manager's WebParts collection, cast it to its type, set property and then save changes via manager: manager.SaveChanges(webPart);


1

I think those URL's have to be sitecollection relative. So if _layouts or /_layouts does not give the right result, I would try the following... If you set the 'UseSiteDefaults' property of SearchBoxEx control to 'True' it will then take the configured values of the site. Site Actions > Site Settings > Search Settings. Maybe that will make a difference. ...


1

Another alternative would be to use the SP.UI.Dialog.args object which would allow us to pass arbitrary properties into the dialog. This could be inturn retrieved from the opened page using the SP.UI.ModalDialog.get_childDialog().get_args() property. Please read this detailed post to find how its implemented - ...


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


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

I can only assume that the web part was added to a page layout that had a web part zone and a rich content zone below it, or had two rich content zones, and only the label for the bottom one is visible. It is a poor example from MS though. They could have at least had more context of the page it's running in, like a Team Site. That way we know what's normal ...


1

this refers to current instance of a class. So this.ViewState refers to viewstate of the control\webpart. So, logically you are wrong here as you are trying to retrieve from the place where you never stored! Now speaking practically, Because the ViewState property is marked as protected, you can't get a control's ViewState in another. If you want to share ...


1

From what i understand, you want to access a property/method from your UserControl in your WebPart? If so, just make them public! UserControl Implementation (VisualWebPartControl1.cs): public partial class VisualWebPart1UserControl : UserControl { public string Something { get; set; } protected void Page_Load(object sender, EventArgs e) { ...


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

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



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