Tag Info

Hot answers tagged

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


10

This has really improved in SP2010. Now you can write to the ULS logs easily even with SharePoint Foundation. All you have to do is this: SPDiagnosticsService diagSvc = SPDiagnosticsService.Local; diagSvc.WriteTrace( 0, // custom trace id new SPDiagnosticsCategory("My category", TraceSeverity.Monitorable, EventSeverity.Error), // ...


8

Remember that SharePoint web applications can have multiple URLs since they can be extended onto different IIS websites e.g. http://authoring.site.com and http://www.site.com. If you're looking to get the URL for the default zone (either with a web app which has been extended or not), you can use: webApp.GetResponseUri(SPUrlZone.Default);


7

As a seasoned ASP.Net developer, I can tell you for certain that you could not have done this with a few web forms in ASP.Net. You would have had to build numerous subsystems for all of the various parts (security, document management, membership, retention, etc). You would also need the obligatory management UIs for all of those subsystems. In addition, ...


6

To clarify: I assume that you have a document library with pages in it, and you intend to reimplement "Delete document" ribbon button functionality: One of the approaches could be to get selected item using SP.ListOperation.Selection.getSelectedItems(), and then use SharePoint Client Object Model to delete it. This is an intended approach. But also it's ...


6

If you examine page source you will see that Select Display Language > Language calls simple javascript: OnSelectionChange(1033); Where 1033 is language id. I have tried launching this form FireFox FireBug console and it works. So your link could be something like: <a href="" onclick="OnSelectionChange(1033);">English</a> You can also ...


5

Try: Repeater.DataSource = oList.Items.GetDataTable(); Repeater.DataBind(); Should do the trick.


5

You can follow steps below: 1) Create a copy of SignOut.aspx in the Layouts folder. Rename it as CustomSignOut.aspx 2) Open the custom page in notepad\designer. In the function _spBodyOnLoad() replace windows.close() with windows.location("YourHomePageRelativeUrl"); 3) Make this page the default sign out page for the web application using below command ...


5

If you just want to update using the ASP.NET AJAX UpdatePanel, then just add a Timer Control


4

SharePoint web parts are there for backwards compatibility. For new development we should use the ASP.NET web parts.


4

Just to elaborate on Wictor's answer, his example will log 'Unknown' to the Area column. SPDiagnosticsCategory has an 'Area' property, but unfortunately its protection level is set to internal. However, you can set it using some reflection code. Listed below is an example of how to write to the SharePoint 2010 trace log using reflection. I use it in a ...


4

I have been told in the past that if you're developing SharePoint and have grown up in ASP.NET, forget everything you knew about ASP.NET (or rather, don't try to apply everything you learnt about ASP.NET). If you're just starting out now, you might want to just start on SharePoint 2010 if you have access to a 64-bit system. I suggest this as Microsoft have ...


4

+1 to James. I want to add to it, too. While SharePoint does a great job with security and collaboration, since this will be customer-facing you should take a good look at whether the collaboration features meets your requirements. For example, the discussion threads are great for an intranet environment, but they do not look and feel like discussion board ...


4

Right after your DataList1.DataSource = UserList; you need to bind it to the DataList using DataList1.DataBind(); adapter.Fill(UserList); DataList1.DataSource = UserList; DataList1.DataBind(); Label1.Text = UserList.Rows[0][0].ToString();


4

SharePoint is nothing more than an ASP.NET application. Here is a brief article covering screen scrapes, and passing authentication via HTTPWebRequest. http://odetocode.com/articles/162.aspx


4

Couple of things with regards to your code: You're redirecting before you try to reset AllowUnsafeUpdates. You should do this BEFORE you redirect. Also, when you try to set properties of SharePoint object references, it's best to create a definite reference to the object first - a lot of SharePoints getters actually create new instances of objects. This ...


4

First a number of small remarks: Usually you don't hardcode the URL of the site you want to work against. It may be ok but if you want to access the current site the just use SPContext.Current.Web Unless you need to make updates on a get you shouldn't set AllowUnsafeUpdates A listbox will not allow you to add images inside it (so in my code I just added a ...


4

Honestly, Denial of Service are better (and must be) handled at levels below SharePoint i.e. ASP.NET, IIS, OS or infrastructure levels. Being an application stack, SharePoint would have no or limited tools to prevent such attacks. Also, trying to handle it at SharePoint level would prove inefficient. I would recommend posting the question in ASP.NET/IIS ...


4

It's throwing the error because the <asp:ScriptManager> tag is most likely defined in your master page, causing two instances on the page you are trying to load. http://social.msdn.microsoft.com/Forums/br/sharepoint2010general/thread/54c271ee-de71-4e47-b02b-29a1d540b81c


4

"It depends" :) No code is great when you want to do something reasonably small, quick, not wide ranging on your site. You can do a fair bit with JavaScript, content editor webparts and client object model. It isn't particularly scalable though. You end up copying a lot of stuff around, hacking away at master pages in notepad, that sort of thing just ...


4

David, I guess there is a MultiSelect property which you can set to false to allow only a single entry of User/Group For example: PeopleEditor Control - The article is for SP 2007 but I hope its the same in 2013


4

The SharePoint WebPart has its roots back from the 2003 version where it inherited directly from Control because ASP.NET had no concept of a web part and SharePoint as in many other cases implemented a lot of the functionallity which was moved into ASP.NET 2.0 in order to allow SharePoint to become a real ASP.NET application in 2007. After ASP.NET 2.0 ...


3

I use the ASP.NET class as that's what Microsoft recommends in Working with ASP.NET 2.0 Web Parts and Windows SharePoint Services 3.0. I haven't found or seen any good reasons to use one over the other apart from the different feature sets each class offers. That is, advanced web part connections are only offered by the SharePoint web part class. Perhaps ...


3

I've never used SmartPart so can't comment on it exactly. However there should be no need to manually copy anything if you are using a packaging solution such as WSPBuilder which can handle all this for you. There's some pretty good doco on the non-SmartPart route: From SharePointDevWiki, SharePoint Development with Visual Design User Controls An article ...


3

I'm a bit torn between the two actually, and my reasons are for things that don't often get a mention. I'm a fan of the ASP.NET web parts .dwp/.webpart xml file schema. I think it's a lot cleaner and you don't have to specify a namespace whenever you specify a custom property value in the file. However some of the things that (sometimes) make me revert ...


3

when it comes to SP2010, webparts that derive from the SharePoint web part are not supported in Sandbox solutions. Source: An Overview of the SharePoint 2010 Sandbox Solution


3

Counting the contents of the item collection can be very slow. Instead use the ItemCount property on the list. With regards to checking for leaks, have a look at SPDisposeCheck.


3

It won't cause a memory leak but it's not best practice. Some API calls require SharePoint to have parent SPWeb and SPSite objects initialised. Accessing the list once its parent web object has been closed could cause errors (perhaps not in this exact code). My opinion is to play it safe and don't risk it.



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