Tag Info

Hot answers tagged

29

There's an out-of-the-box way to remove the Add new item link. If you edit the webpart properties using the Modify Shared Web Part command, you'll find the Toolbar Type dropdown in the List Views section. If you choose No Toolbar there and save the page, the footer link will be gone. No code required, no unghosting/customization, and no effect on other web ...


16

Never put SPContext.Current.Site (or web) into a variable in a using statement. You're not allowed to dispose them, they are passed on to the next web part and SharePoint will dispose them when done. So change using (SPSite oSPSite = SPContext.Current.Site) { .... } to SPSite oSPSite = SPContext.Current.Site; ....


15

The Announcements list seems to be the most obvious choice to me. Rich text capabilities, expiration so it will automatically disappear from web part views on the main page, audience targetting.


15

Short explanation: As far as usage is concerned, in many common cases there are almost no actual differences - anything you can do with a webpart you could do with a visual web part. For many points of view the visual web part is only a tool that enables the developer to work with a user control instead of creating all controls in codebehind. Visual web ...


14

If you just want to hide it, you can use following css (you must override sharepoint core css with your custom css file) td.ms-addnew{ display:none; }


13

Like Bill mentions, the SharePoint web part is primarily there for backwards compatibility, although it does provide 4 features that are not available in the standard asp.net web part:- Cross page connections Connections between Web Parts that are outside of a zone Client-side connections (Web Part Page Services Component) Data caching infrastructure, ...


13

You should remove <Query> and </Query> and use only inner XML. So in your case the .Query should be: itemsByDateQuery.Query = "<Where><Geq><FieldRef Name=""EventDate"" /><Value Type=""DateTime""><Today/></Value></Geq></Where><OrderBy><FieldRef Name=""EventDate"" Ascending=""True"" ...


13

The best way to do get a quick view of what is being used where in a given content database is with the stsadm command enumallwebs using the addtional parameters supplied with the October 2009 Cumulative Update: stsadm -o enumallwebs -includefeatures -includewebparts -includeeventreceivers -includesetupfiles -includecustomlistview There's also a useful ...


12

You can create a feature and on the activation of the feature you can add the webpart to the page. public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPSite site = properties.Feature.Parent as SPSite; using(SPWeb web = site.OpenWeb()) { using(SPLimitedWebPartManager wpManager = ...


12

You can certainly do this for Content Query Web Parts, but beware that some web parts might be sealed. If you use ILSpy you can view the SharePoint Assemblies to gain understanding of how the OOTB web parts work. Here's a link to ILSpy: http://wiki.sharpdevelop.net/ilspy.ashx Here's a link to Andrew Connell's blogpost on extending the Content Query Web ...


12

You can't deploy a Web Part at the Scope = Web level. Web Parts must be deployed at the Site level since the .dwp or .webpart file needs to be deployed to the Web Part gallery, which is at the Site Collection level.


12

I usually use SPUtility.Redirect when working with Application Pages or pages that need to potentially look at the source querystring or go back to settings.aspx. If I am doing a redirect other times (usually in an HttpModule), I will use the Context.Response.Redirect or HttpContext.Current.Response.Redirect. The Page.Response.Redirect is just exposing the ...


12

You can always add ?contents=1 to any url in SharePoint to see what specific webparts that are used in the site/page. Example: 'http: //test.sharepoint.com/Pages/default.aspx?contents=1'


11

go to pagename.aspx?contents=1. This will let you manage your webparts


11

I'd avoid branching as it will get very difficult to manage when multiple webparts are under different parts of development. Been there - a messy code handed to me and had to figure out better way to maintain. This kind of issues crop up due to "type-based" project structure, where all webparts are under "WebParts" project, all features are under ...


11

The reason is that you are hijaking the onlod event from the SharePoint javascript. See this post for help http://haacked.com/archive/2006/04/06/StopTheWindow.OnloadMadness.aspx


11

SharePoint also provides the _spBodyOnLoadFunctionNames function, which allows you to specify what script to run on page load. If you specify your function there, it is less likely to interfere with SharePoint's own script.


11

SharePoint solution packages consist of a .WSP file that you can create using Visual Studio (or manually if you so wish). Before deploying to a production environment, I recommend you take a look through Deploy solution packages (SharePoint Server 2010). Basically you need to add your solution to the solution database of a SharePoint Server farm using the ...


11

I came across this link by Josh Gaffey that describes how to set the welcome page for a publishing site. The code I used is: ... // Create publishing page if (bPageCreated) { using (SPSite site = new SPSite(p_sSubSiteUrl)) { using (SPWeb web = site.OpenWeb()) { PublishingWeb publishingWeb = null; if ...


11

Here is my fix to the problem. It seems in SP 2013 calling ExecuteOrDelayUntilScriptLoaded() doesnt work on published pages. In SP2013 this is the correct way to do it according to MS @ http://msdn.microsoft.com/en-us/library/jj245759.aspx // Make sure the SharePoint script file 'sp.js' is loaded before your // code runs. SP.SOD.executeFunc('sp.js', ...


10

Yes. You need to activate Site Feed feature in Site Settings --> Manage site features. Then, when adding web part, under Site Collaboration group you will have the Site Feed WebPart UPDATED Yo must activate this feature in _layouts/15/ManageFeatures.aspx


9

You can add ?contents=1 to the current page url to view a 'web parts maintenance page'. From there you should be able to see the web parts on the page, the type, and if they're open or closed.


9

My general rule of thumb on application page versus web part is re-usabilty...i.e. do I need to surface the capability in more than one location within a site. If I'm only going to surface a single instance of the functionality then surfacing that capability via an application page is the way to go because they are much easier to build, deploy, and maintain ...


9

You can use webparts on your application page. They won't be customizable then, but they are put on the page as webcontrols: register your namespace that your webpart resides in: <%@ Register TagPrefix="prefix" Namespace="YourNameSpace" Assembly="Assembly" %> Then add your webcontrol by using the following code: <prefix:WebPartClassName ID="ID" ...


9

Visual Studio deploys to the server it's installed on, and as a best practice it shouldn't be installed on any production server. During the deployment process, the applicable bits for the solution will automatically be "deployed" to any server in the environment with the Foundation Web Application role. For deployment to production, the correct process ...


9

When you deploy a solution with a WebPart it deploys three things: The dll with the web part A SafeControl entry to be inserted into web.config A .webpart (or .dwp) file with configuration settings to be inserted into the Web Part Gallery (this part actually happend at feature activation not at solution deploy, but..) When you're adding a web part to a ...


9

I found a solution for this problem. below code should be added to ascx file <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <SharePoint:ScriptLink name="clienttemplates.js" runat="server" LoadAfterUI="true" ...


9

In addition to traditional web parts still being supported (in either full-trust or sandboxed solutions) as Simon mentions, you can develop new app parts in an app for SharePoint 2013. An app part is like a web part, and in fact is also made available to users in a host web's web part gallery. Users add app parts to pages the same way they would add web ...


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


8

Sounds like you are missing the <SafeControl> element from your package. Normally it is added for you if you create it in VS2010. But if your web part/control is in another assembly you may have to add it manualy http://msdn.microsoft.com/en-us/library/ms412965.aspx Something like this should go in your Package.Template.xml file (Solution explorer -> ...



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