There are times when I’ve built up a page with complex Data View Web Parts (DVWPs) which take a *really* long time to load in SharePoint Designer 2007. The usual reason for this is that I’m using a Web Service as a DataSource which returns a large amount of data or that I’ve got many DataSources in an AggregateDataSource.
In the former case, setting the Show with sample data option usually doesn’t help, as you don’t always have the option to limit the returned data. This option can be a real timesaver in many cases, however.
In the latter case, it’s simply that SharePoint Designer has a *much* slower rendering engine than your browser does (at least that’s what I think it is).
There’s a trick for this when you need to make quick edits. You can right click on the file name and choose Open With > SharePoint Designer (Open as Text). Depending on what other programs you have installed on your machine and how you have things configured, you may see other options as well, like Notepad or Visual Studio.
By opening the .aspx page as text, SharePoint Designer doesn’t try to do any interpretation of the page whatsoever. This means that you can almost immediately make your edits, but you get none of the usual Intellisense, syntax help, unescaping, or color coding. So it’s great for quick edits or making changes where you really know what you are doing, but it’s hardly where you want to spend all of your time.
By the way, the exact same technique works in SharePoint Designer 2010, though I haven’t needed to use it much yet. I don’t know if I’ll run into the same slow page stuff there or not. One would hope that the rendering engine there is better, though since Microsoft doesn’t look at SharePoint Designer as a real IDE, they may not have made that sort of improvement. I’ll let you know what I find as I do more SharePoint 2010 work!
For whatever reason, Microsoft in its infinite wisdom seems to have removed the ‘Connect to another library…’ link in the Data Source Library in SharePoint Designer 2010. Maybe that capability is hidden somewhere else now, but as my pal Chris Givens pointed out the other day in his Missing Features from SharePoint Designer 2010 post, it’s not “findable”.
Fortunately there’s a workaround and all of your 2007 Data View Web Parts (DVWPs) should work in 2010. (At least if this is the only issue!) You can simply add the same line into the DataSource that you would get if you used the ‘Connect to another library…’ link in 2007. The net-net in 2007 is that you end up with the WebPartPages:DataFormParameter named WebURL in your DataSource section. That’s the entire difference in the code if you want to access content in a different site: the WebURL parameter. By setting that parameter to the relative URL of the site where the content resides, you can access content in any other site with a DVWP, just like in 2007. You just have to do it manually in the Code View.
Here’s an example of accessing an Announcements list from the root site in a SharePoint 2010 Site Collection which resides in a subsite called ‘Marc’. Note that I’ve also switched from ListID to ListName in this example. As long as your information architecture is solid, that switch can be useful to make your DVWP code more readable. It also can make your DVWP more portable to other sites or Site Collections.
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" UseServerDataFormat="true" selectcommand="<View&gt;</View>" id="dataformwebpart1">
<WebPartPages:DataFormParameter Name="ListName" ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Announcements"/>
<WebPartPages:DataFormParameter Name="WebURL" ParameterKey="WebURL" PropertyName="ParameterValues" DefaultValue="/Marc"/>
Note that you may also need to remove several attributes in the WebPartPages:DataFormWebPart header. If you are getting an error, check for attributes like this:
and remove them. Removing these attributes won’t break the DVWP, and will fix the error.