Access data cross sub-sites – an old way which is still reliable

This post is about how you can read the data from one sub-site to another sub-site. As a special note, I am not talking about how to access data from one site to another inside the same site collection. Is a common confusion to name site collection what is actually top level site.

As a practical example for this article, we need to display data from a sub-site called “Primary Site”, with URL “/PrimarySite”, into a drop down list control placed in a page inside “Secondary Site”, with URL “/SecondarySite”. Need to mention the top level site has the following URL:

To do the task, all you need are several lines:

<SharePoint:DVDropDownList runat="server" DataSourceID="SourceOfData" DataValueField="Title" DataTextField="Title">

<SharePoint:SPDataSource runat="server" DataSourceMode="List" ID="SourceOfData" SelectCommand='<![CDATA[<View></View>]]>'>
<asp:Parameter Name="ListName" DefaultValue="Data Source List" />
<asp:Parameter Name="WebUrl" DefaultValue="/sites/toolkit/PrimarySite" />

Please note importance and effect of WebUrl select parameter, which should be composed from URL of the parent site (excluding of course part) and URL of the sub-site where list to serve as data source is created.

This might help you working with custom forms. And sometimes, I think these are better than complicated JavaScript solutions.


Author: anvlpopescu

Nothing special to say. I'll think about it more and let your know.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s