.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Make a webpart properties customizable only by an Administrator

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :SharePoint
I am developing a sharepoint 2010 visual webpart that will show some sort of ajax content. I have a property on the webpart for the refresh rate, but I want this property to be set only by an Administrator (or any specific group). What is the best way to achieve this? Thank you.

View Complete Post

More Related Resource Links

Rowlimit and PageFirstRow properties of listview as parameters to Listview Webpart


Hi ,

 I need to set the  Rowlimit  and PageFirstRow properties  of  listview  as  parameters to Listview Webpart

 And these parameters  will be passed from the custom provider webpart


name of the list will be provided in custom webpart's toolpane.

and i need to save this as list content type of list defs


Please provide me the guidance on this.



How to design common page across different sub sites and make them customizable?

I have a requirement to develop common pages with web parts and all authoring capabilities that should be hosted in the top level site and can be shared among all sub sites. The advantage of this should be as long as the sub sites don't want to customize this common page for look and feel or authorizing content this page will be served as a common page and yields the performance benefits. But when the sub site wants to customize the common page, it will have its own copy and any changes made to the common page shouldn't be available for the customized common page. How can I achieve this? I tried with the application page by hosting them into the 14\TEMPLATE|Layouts folder, but couldn't see the publishing capabilities enabled. Help will be greatly appreciated.

Changing Properties/Attributes of a Webpart in inline code block - Error 'System.Web.UI.WebControl

I'm trying this code below, but gettting error: System.Web.UI.WebControls.WebParts.WebPart' does not contain a definition for 'FilterValue1' I need to change the value of the FilterValue1 properties of a content Query WebPart with title = Applicant Files. Thanks in Advance!
protected override void OnLoad(EventArgs e) {  base.OnLoad(e); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite SiteCollection = new SPSite("https://somesite/")) { SPWeb myWeb = SiteCollection.OpenWeb(); myWeb.AllowUnsafeUpdates = true; Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null; mgr = myWeb.GetLimitedWebPartManager("default.aspx",System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); foreach (System.Web.UI.WebControls.WebParts.WebPart myWebPart in mgr.WebParts) { if (myWebPart.Title == "Applicant Files") { myWebPart.FilterValue1 = "/13"; mgr.SaveChanges(myWebPart); break; } } } }); }

Change webpart properties programmatically

I am attempting to modify the properties of another webpart when my webpart's button is clicked. The code compiles and runs, and stepping through it shows that the properties do change. However, they don't stay changed. This example attempts to toggle the visibility state, but other properties won't stay changed either. Any help is appreciated.     SPSecurity.RunWithElevatedPrivileges(delegate() { // get the site in this context using (SPSite SiteCollection = new SPSite(mySiteGuid)) { // get the web in this context SPWeb myWeb = SiteCollection.OpenWeb(myWebGuid); myWeb .AllowUnsafeUpdates = true; // Hide/display another webpart. Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null; mgr = myWeb.GetLimitedWebPartManager( "default.aspx", System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); foreach (System.Web.UI.WebControls.WebParts.WebPart myWebPart in mgr.WebParts) { // If this is the webpart we want to modify... if (myWebPart.Title == "Other Webpart Name") { // Toggle the visibility state. myWebPart.Visible = ! myWebPart.Visible; myWeb.Update(); break; } } } });

Accessing SelectedItem of DropDownList in WebPart Custom Properties



I've made a simple Visual Web Part using an AJAX timer to count down to dates.

I have added a custom property which is a list of events, but I cannot find the Selected Item value in my ascx.cs file.

Here is how the property is set:















 VisualWebPart1 : WebPart




 EventList myEventList;


), Category("Configuration&quo

how to make webpart only show top list item?

Our office is new to SharePoint (including me!).  On our new SharePoint intranet I want to create a SharePoint Tips list.  I then want to put a WebPart on the home page that only shows the most recent tip added to the list.  I can't figure out anyway to configure that.  Thanks for suggestions.

Where to find (or how to make) OOB WebPart CDATA xml for onet.xml file


When you are attempting to add Web Parts in Modules to an onet.xml file, what is the best way to find (or make) the appropriate xml information that goes inside the <[CDATA [ ]]> element.

In particular, I'm trying to add the "Shared Documents" webpart, but from the sts (OOB Team Site template), the onet.xml does not have it listed (or is the oob template for Team Site not "sts"?).

But in general, how do you get this info for customizing web part include referencs in an onet.xml?

Content Editor WebPart error "Cannot retrieve properties at this time"


I've found a similar post: http://social.technet.microsoft.com/Forums/en/sharepointadmin/thread/fc9b388c-2a16-436c-afb4-b6d06b2f5fe5...but i don't have the same errors on the event log.

- SP2 installed already

- Recyle Application Pool works but only temporarily ... it keeps happening again

I have the following and any help would be much appreciated!!!


Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6482
Date:  10/13/2010
Time:  4:13:34 PM
User:  N/A
Computer: XX1
Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (a21cc2ec-8b2b-4ee1-bcc6-d971a5dcc263).

Reason: The trust relationship between this workstation and the primary domain failed.

Techinal Support Details:
System.SystemException: The trust relationship between this workstation and the primary domain failed.

   at System.Security.Principal.SecurityIdentifier.TranslateToNTAccounts(IdentityReferenceCollection sourceSids, Boolean& someFailed)

how to make VS Intellisense show complex object's properties for result of Ajax call?



I've create a WCF webservice and created a proxy to the service using ScriptManager.

I can see the created a proxy class, and intellisense pops up the methods of the webservice (great!!). But, I can't see the properties of the method params, return types.

The webservice method:

searchResponse DBSearch.Search(searchRequest)

have comlex types as a parameter (searchRequest) and a return type (searchResponse).

Intellisense does recognize these types, but I can not see the properties (javacript does);


var _searchRequest = new DBSearch.SearchRequest; (intellisense knows type SearchRequest)

_searchRequest.query = "liver lacerations"; (intellisense doesn't know it's property 'query')

_searchRequest.searchOptions = "modality=mri";

Obviously, with javascript, var _searchRequest is not typed, but is there a way to hint intellisense into the properties of the class?



How to make it work multiple "I need to.." webpart in the same page..


I am trying to create multiple "I need to.." web parts in the same page.  But only first created web part working.  Rest of all the web parts either not respond after click "GO" button or goes to the first web parts selection, even click on another web part.  I am using Team Collaboration web page.  I tried to create different custom list to different web part did not work, and link to the same custom link with different filter settings as well did not worked.

Some search across the web showing few people have same problem, but no clear fix found.  Does anybody know some sort of tweaking or coding for this problem..

I am using Sharepoint 2007 with MOSS2007..


How to make Custom SharePoint 2010 Webpart work on MOSS 2007 Environment



I've built a SharePoint WebPart in SharePoint 2010, using SharePoint Assembly version Now i've to make this Webpart such that i should work on SharePoint 2010 and MOSS 2007. The version no for both the versions are different, so do i need to create separate web-part for both version or is there any other way?

My current webpart is built in env, which has

SharePoint 2010, Windows 7 64 Bit, VS 2010.

Reference is added to SharePoint DLL which is in 14 Hive ISAPI.


How can i make this generic, so that i should work on both version, i've not used anything specific which is only in SP2010, its just a simple webpart.


Akhilesh Nirapure

How to make a textbox or a label in my own webpart connectable with webparts from sharepoint webpart

I'm developing a webpart which need to be able to receive data from standard webparts from sharepoint.
My webpart needs to get data from a sharepoint formfield in an editform from a list.
I know how to connect 2 standard sharepoint webparts with sharepoint designer. But I can't seem to figure out how to connect my own webpart with a webpart from sharepoint. All I can find on the internet are examples where you need to have your own provider and consumer, not just the consumer.
So basicly I need my webpart to be able to connect with sharepoint webparts, just one connection is enough.

I'm developing for sharepoint 2007 with visual studion 2008. 

Content Editor WebPart Cannot retrieve properties or save changes


When a content editor webpart is open for editing - if they use the Rich Text Editor the error message is "Cannot retrieve properties at this time

If they use the Source Editor - they can make changes but it give them the message "Cannot save changes"

Sheryl L Fackler

Webpart properties getting empty after IIS Reset


HI All,


I created a custom webpart property for my SharePoint webpart. The property has a textbox which is getting empty after an IIS reset. Can anyone tell me how to solve this issue!!!

How to Make Properties Search Work in the Advanced Search page?


I work in SharePoint 2007. I have created "Advanced Search" page. It is the standard advanced search page and is created by choosing "search center" option when you "create site" in site settings.

The top part of this advanced search page has fields to enter search terms. This will search full text of documents. This part works.

Bottom part of the search page includes properties search. I know how to add or change those properties in the list. It is done through XML file which can be found in "Edit Page", "modify the web part", and it is in properties.

I have added a new property in this XML file but it does not appear in the drop-down list in the search page. I know that this property must exist and data has to be populated in at least one record for this property to show up in the drop-down list. This has been done and still the added property does not show up in the drop-down list in the search page.

What else do I need to do to make properties search work?


Thank you very much in advance for your help.

Can i change the webpart zone properties according to the sharepoint group?



Is it possible to change the webpartzone 'AllowLayoutchange' property for each sharepoint group.

when i am trying it is giving me error that i "cannot change the property when it is added to page"




Cannot view webpart in browser after adding Group Properties


Ihave a customized web part, this can be shown properly in browser.

however, in the dataview, if I added "Collapse group by default ", it looks fine in sharepoint designer. But, when it goes to browser. i got the following error:

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.

Please help ! ! !

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend