How can I get my custom field type (lookup) to render in list view on SharePoint 2013? - sharepoint

I have a custom field type that was built for SharePoint 2010 that I have installed on SharePoint 2013 Foundation. The wsp installed perfectly and I get all the same functionality.
The one problem I am having is how the information is displayed in the list view. I am inheriting an SPFieldLookup and am not doing anything to override how this is displayed in the list view.
On SharePoint 2010 it renders perfectly as a hyperlink to the item which opens the standard pop out window on click etc. On SharePoint 2013 Foundation however the html doesn't render properly at all- it is almost as though it is displaying as plain text.
SharePoint 2010:
SharePoint 2013 Foundation:
My question is how can I get the lookup value to render properly on SharePoint 2013?
The same version of the wsp in installed on both machines.
Unsure as to whether this was simply a browser or client side issue I added a standard lookup field to the list and it renders fine!

I had the same issue with my codeplex project which is based on Lookup field. I added a link to dummy JS file and overrode the JSLink property of the field class. I have blogged about it here: http://sharepointnadeem.blogspot.in/2013/12/sharepoint-2013-upgrade-sharepoint-2010.html

In SP 2013 by default field rendering is done on client side. Concept of JSLink has been introduced if you want to change the look and feel of field.
However by ClientRender=False in new form url you can force it to server render mode.

So after an afternoon of head scratching it turns out that this is not a deployment issue. It probably didn't even warrant a question but for anyone who has the same problem as me...
If you edit the page and modify the listview settings you will see that there is a new setting called "Server Render".
I guess this ultimately gives you more control but in may case it prevented my fields from rendering as expected- turning this on meant my custom fields we once again displayed 'normally'.

Related

Returning user profile properties on a page layout in SharePoint Online?

On my SharePoint 2013 dev environment this code in a custom page layout brings back the current users first name:
<SPSWC:ProfilePropertyValue runat="server" TitleMode="true" PropertyName="FirstName"/>
However if I add this to a page layout in SharePoint Online in Office 365 it returns nothing (just blank).
Is this a possible bug or by design?
I want to bring back this property server side rather than with client side scripts as I want to be able to use it before doc ready.
I discovered the answer was because you need to use the 'ProfilePropertyLoader' tag first eg:

Adding HTML controls to SharePonint 2010 quick launch

We are migrating Lotus Notes application to SharePoint 2010. There are around 200 views on navigation pane of Lotus Notes. In order to provide similar kind of look and feel on SharePoint I am thinking to add dropdown on quick launch of my site.
Is it possible to add HTML controls like dropdown and add a functionality to navigate to respective view? Or else what could be the better solution for this case?
Thanks,
Pratima
You can use the ASP.NET placeholders available in the masterpage to host a control or WebPart beside the Quick Launch. The actual QuickLauch is generally customized by JavaScript unless you want to replace it with a completely new class.

How to add a webpart to a listview in sharepoint 2010?

I have to add a "Content Editor" web part to a list view. The "Content Editor" is required to implement some java script and a html textbox.
The problem is that after adding the web part to the list view the dropdown to switch your current view gets lost. It doesnt matter where you add the web part or if you try it with the designer or IE.
Do you have any ideas on how to solve this? Or is there another way to implement java script into a listview without adding a new web part?
This is the dropdown I mean:
Its a known issue with SharePoint 2010.
You can modify the page using SharePoint Designer to put it back.
http://vintentou.wordpress.com/2010/08/03/missing-dropdown-menu-for-choosing-of-views/
My company has also produced a free add-on that will do this for a whole site.
http://www.pentalogic.net/sharepoint-products/free-stuff/view-rescue

Load a web part before other

I am stuck with a problem. I am having tool part where I get all the Lists present in the Site.
I have other web part which should get the selected List in the tool part.
I see that the web part is loaded first then the tool part. so the web part is unable to the List selected in the tool part.
Please note that the text box is in a User Control.
Please help me.
I have looked at your code and found the following:
First things first. You need to move AWAY from using ToolParts and the SharePoint native webpart. they are deprecated and are a remnant from SPS2003. In MOSS / WSS 3.0 you can and should use the ASP.NET WebPart.
Secondly, I think you are mixing things up. The ToolPartGetLists is not a toolpart, it is a webpart, that in itself loads the CustomToolPart, which in turn allows you to select a list.
This toolpart is only shown when you edit the shared webpart in the UI. The list you select is then persisted to the SelectedList property of the webpart using the toolpart.
The connected webpart then tries to read the SelectedList property I guess.
Like I said, I could go and try to fix the code for you, but it is not the way to go, you really (REALLY) need to switch to ASP.NET WebPart based webparts. The native sharepoint one WILL be fased out in the (near) future.
Here you can find an example, with code! (scroll to bottom for download link). As a bonus, it uses the built in sharepoint listpicker
I don't know of any way you could control the load order of elements (web parts) on the same page.
Sounds more like you want to have your second web part (the display of the lists) have a "default" when the page loads--which could be empty. Then it would be changed to the selected list only when the user clicked a new selection in the other web part (the list of lists).

How to determine if Toolpart is running inside SharePoint Designer

A web part can't use certain objects such as Page.Request as detailed in Best Practice to create designer friendly server controls when running in a designer such as SharePoint Designer.
You can use the DesignMode property to determine if a web part is running inside a designer and act appropriately.
However this doesn't seem to work for Toolparts - it always returns false.
How do you determine if a Toolpart is running inside SharePoint Designer?
We need the Toolpane.InCustomToolpane property
So from the toolpane code its
this.ParentToolPane.InCustomToolPane
An aside - I think the reason for this difference (though its a poor reason) is that the web part page is loaded into a designer taken from Visual Studio (Whidbey) as mentioned in the msdb blog, but the toolpart is loaded into a browser window.

Resources