Web Controls

What is the _layouts/15/start.aspx in SharePoint 2013

René Hézser

SharePoint 2013 immediately redirects you to an application page start.aspx when you call a website.

If you’ve ever wondered why, keep on reading… image

image

The pictures will also look familiar to you. So what happened? Why the start.aspx?

The start.aspx inherits Microsoft.SharePoint.ApplicationPages.MDSStartPage. That page simply looks, if the SPContext.Current.Site.CompatibilityLevel is above 14. If not, it’ll redirect to web.Url. That is the behavior, we know from previous versions of SharePoint.

Control.ClientID has wrong value

René Hézser

An ASP.NET Controls has a ClientID property. SharePoint Controls inherit from the ASP.NET Controls. The property will give you the ID, the rendered control will have in the HTML source. There is one thing to remember:

The ClientID is valid only, if the control has been added to the Controls of the Page!

ID **before** adding the control ID **after** adding the control FilterButton **ctl00\_m\_Webpart1_**FilterButton

So if you need the ClientID e.g. to pass it to a JavaScript to be able to find the control, make sure you grab the ClientID after the control has been added to the Page.

Using SharePoint Controls

René Hézser

Back from vacation. 1 week with an offline version of feeds is hard. So I read the postings I got closely 🙂 One post I do want to bring your attention to, is about SharePoint Controls.

My post about using the SharePoint Controls shows how to use the controls you see in forms (TextField, NumberField, LookupField…).

There are plenty of SharePoint controls, which you can use. Robin Meure has written a post “re-using SharePoint controls”. The controls in his post are:

How to use the SharePoint Web Controls – Update

René Hézser

My post How to use the SharePoint Web Controls has been updated.

It now shows how to use a generic control for each SPField, instead of picking the corresponding SharePoint Web Control.

 1: BaseFieldControl webControl = field.FieldRenderingControl; 

<span class=lnum>   2:  </span>webControl.ListId = list.ID; 
 3: webControl.ItemId = item.ID; 
<span class=lnum>   4:  </span>webControl.FieldName = field.Title;
 5: webControl.ID = GetControlID(field);
<span class=lnum>   6:  </span>webControl.ControlMode = mode;

Thanks for all the great comments and ideas!

SharePoint Web Controls to access remote content

René Hézser

In my post How to use the SharePoint Web Controls I talked about using the SharePoint Web Controls to show and edit data in SharePoint lists.

Today I want to post a sample how to work on a list, which is in another web. The remote list will be the “User Information List” which exists on every rootWeb.

 1: // connect to the rootweb, to read the users list

How to use the SharePoint Web Controls

René Hézser

SharePoint brings its own controls, which can be used to display list items. In this article I want to show you how to use them in a Webpart. It took me a while to figure this out, because the documentation is kind of incomplete L

OK. Lets start. First lets find out which SharePoint Web Control belongs to which data type in SharePoint.

 

 

 

 

 

SharePoint Web Control

SharePoint data type