Partilhar via


SPDataSource and Rollups with the Data View

Hello -- my name is Eray Chou. I’m a Program Manager on the SharePoint Designer team. I focus mostly on data and app building features, and last release I worked on the Data View. During the last year or so, I also led development for the Application Templates for Windows SharePoint Services 3.0. I’m looking forward to posting tips and tricks about using the Data View (the Swiss Army Knife of web parts) and JavaScript (Duct Tape on the web). As MacGyver taught us – you accomplish some pretty cool things with a Swiss Army Knife and Duct Tape. For this post, I’ll give a brief overview of the SPDataSource control, as well as cover a pretty popular question: How do I create a view that rolls up data from across my site collection?

Data View vs. Data Form

Before we go deeper, you may have noticed that many of us use “Data View” and “Data Form” rather interchangeably. In Windows SharePoint Services v2, we shipped a web part called the DataViewWebPart (DVWP). This web part uses XSLT to transform data from Data Retrieval Services to HTML. In Windows SharePoint Services v3, we shipped a web part called the DataFormWebPart (DFWP). The DataFormWebPart still uses XSLT, but now uses ASP.Net 2.0 Data Source Controls for data access. In addition to “view” functionality, the DataFormWebPart also introduced “form” functionality to write back to various data sources. We use Data View generically to refer to the feature set and all of SharePoint Designer’s UI still uses the term Data View. Because this blog is SPD and Windows SharePoint Services v3 centric, we always mean DataFormWebPart (DFWP) under the covers unless otherwise specified.

Data Source Controls and SPDataSource

As noted, in Windows SharePoint Services, we redesigned Data Views to be an ASP.Net data bound control that uses ASP.Net 2.0 Data Source Controls for data access. To support this improvement, we also shipped a number of Data Source Controls for different data source types like the SPDataSource for SharePoint list data, XmlUrlDataSource for RSS/REST, and SoapDataSource for SOAP Web Services. Developers can also implement their own data source controls for other data source types. As long as a data source control implements the IDataSource or IHierarchicalDataSource, you can use the Data View to display data from that control.

Most of the Data View’s List-related features use the SPDataSource in List or ListItem mode. In these modes, SPDataSource returns multiple or single rows of list data respectively. However, in addition to these modes, the SPDataSource has a number of other modes that aren’t directly exposed in the UI: ListofLists, Webs, and CrossList mode. ListsofLists and Webs mode show the collection of lists and the collection of subwebs for a given Web site.

Here's a sample of SPDataSource:

<SharePoint:SPDataSource runat="server"

DataSourceMode="List"

SelectCommand="<View></View>"

id="DataSrc1" >

<SelectParameters>

<WebPartPages:DataFormParameter Name="ListID"

ParameterKey="ListID"

PropertyName="ParameterValues"

DefaultValue="AAAAAAAA-BBBB-CCCC-DDDD-EEEEFFFF0000" />

</SelectParameters>

</SharePoint:SPDataSource>

The key parts of the markup include:

  • DataSourceMode – type of WSS data to query. The valid modes are List, ListItem, ListOfLists, Webs, and CrossList.
  • SelectCommand – actual query for that data type. Some modes don’t require a query at all. In List mode, the SelectCommand roughly maps to the SPQuery object and accepts Collaborative Application Markup Language (CAML) fragments to specify things like the set of return fields, filtering, and sort order. The example does not specify any query, so the SPDataSource will return all fields and all items.
  • SelectParameter – each command expects a number of different parameters. These parameters can refer to the parameter bindings collection in the Data View, as well as take most ASP.Net types of parameters like Control and QueryString. The example only specifies a ListID GUID, so the SPDataSource will return data from the list with the corresponding ListID.

For more information on Collaborative Application Markup Language's query syntax, check out these links:

SPDataSource Parameteres

When in List or ListItem mode, the SelectParameters collection expects a number of well known parameter names to determine the appropriate list to bind to:

  • ListID – GUID that corresponds to a List’s ListID.
  • ListName – Display name for a List.
  • ListItemId – ID for a single item in ListItem mode
  • WebUrl – Url to the web. When not specified, SPDataSource uses the current web to resolve the previous parameters. You can also use this parameter to access lists in other Web sites in the same Site Collection assuming you have permissions to that list.

In the previous example, the ListID parameter was a static value and just used the value specified in DefaultValue. Parameters can also be dynamic and used inside a query, as demonstrated in the next example:

<SharePoint:SPDataSource runat="server"

DataSourceMode="List"

SelectCommand="<View>

<Query>

<Where>

<Eq>

<FieldRef Name='ContentType'/>

<Value Type='Text'>{ContentTypeName}</Value>

</Eq>

</Where>

</Query>

</View>"

id="DataSrc1" >

<SelectParameters>

<asp:QueryStringParameter Name="ContentTypeName"

QueryStringField="CType"

DefaultValue="Announcements"/>

<WebPartPages:DataFormParameter Name="ListID"

ParameterKey="ListID"

PropertyName="ParameterValues"

DefaultValue="AAAAAAAA-BBBB-CCCC-DDDD-EEEEFFFF0000"/>

</SelectParameters>

</SharePoint:SPDataSource>

In this example, the SelectCommand specifies a filter for items of a specific content type. The SPDataSource uses curly braces to specify substitution parameters: {parametername} . Notice that the QueryStringParameter is named “ContentTypeName” and within the SelectCommand the Where clause is comparing a field value to “{ContentTypeName}”. At runtime, the value of ContentTypeName parameter is pulled from a QueryString variable called CType, and its value is substituted into the SelectCommand.

CrossList Mode

One of the most powerful new OM calls in Windows SharePoint Services v3 is the GetSiteData method on the SPWeb object. This method makes it possible to query for items across multiple lists in multiple Web sites in the same site collection. This is most often used for queries like, “show all tasks that are due today”, “show all documents created by me in the site collection”, or “show all announcements in the site collection”. The SPDataSource exposes this functionality when in CrossList mode.

<SharePoint:SPDataSource runat="server"

DataSourceMode="CrossList"

SelectCommand="<Webs Scope='Recursive'></Webs>

<Lists ServerTemplate='104' BaseType='0'></Lists>

<View>

<ViewFields>

<FieldRef Name='ID'/>

<FieldRef Name='ContentType'/>

<FieldRef Name='Title'/>

</ViewFields>

</View>"

id="DataSrc1" >

</SharePoint:SPDataSource>

The SelectCommand for SPDataSource in CrossList mode roughly maps to the SPSiteDataQuery object, much like how the SelectCommand in List mode roughly maps to the SPQuery object. The new pieces of syntax are the Lists and Webs elements.

  • Webs element – specifies the scope of the query. “Recursive” scope covers all web descended from the current Web site. When using this element with SPDataSource, use a closing element tag (</Webs>) as opposed to single element notation (<Webs />)
  • Lists element – limits the query to lists with a specific ServerTemplate or BaseType. In the example above, the element limits the query to Announcements lists (ServerTemplate='104'). See the description of the Type attribute for a list of ServerTemplate numbers: https://msdn2.microsoft.com/en-us/library/ms462947.aspx
  • Lists sub-elements
  1. <List ID="GUID"> - supports asking for specific lists by ListID.
  2. <WithIndex FieldId="GuidOfField" Type="Text" Value="" /> - limits the query to lists with indexed fields.

Create a view that shows all announcements in the site collection

Using SPD, the easiest way to create a Data View that uses a CrossList query is to design much of the view while in List mode, switch into code view, and add the additional elements by hand. Here are the steps to create a simple view that shows all announcements in the site collection.

  1. Open a Windows SharePoint Service v3 Team Site in SharePoint Designer.
  2. Insert a view on a the Announcements list with the Title, Body, and Modified fields.
    For more information on how to insert a Data View, see the articles here: https://office.microsoft.com/en-us/sharepointdesigner/CH100667641033.aspx
  3. At the top of the Data Source Details task pane, click “Announcements…” to open the data source properties for the current view.
  4. Click on Fields and remove all fields except ID, Title, Body, and Modified.
  5. Switch to code view, and search for DataSourceMode
  6. Change the value from List to CrossList
  7. Next search for selectcommand
  8. In the select command, type <Webs Scope='Recursive'></Webs> immediately after the opening quote, and leave the rest of the selectcommand as it. You should see something like this: selectcommand="<Webs Scope='Recursive'></Webs>&lt;View&gt; ...”
  9. Save the page and browse to it (F12).

Hope you enjoyed my first post.

Thanks,
-- eray

Comments

  • Anonymous
    April 24, 2007
    Thanks for some great info!!! I have a question about accessing web services across Web Applications using the SoapDataSource. Unless the web application is using Kerberos authentication I can't get this to work. I get an error saying: http://server/_vti_bin/webpartpages.asmx and http://server:85/_vti_bin/lists.asmx">http://server:85/_vti_bin/lists.asmx are not in the same web application.  Their domains cannot be compatible. The scenario I tested is as follows:
  1. Create a DataFormWeb part using SharePoint Designer and put it on web application http://server:80 Consume data from the Lists.asmx Web Service that resides on Web Application http://server:85 WSS won't allow this, if I look in the WSS log file I se entries like this: http://server/_vti_bin/webpartpages.asmx and http://server:85/_vti_bin/lists.asmx">http://server:85/_vti_bin/lists.asmx are not in the same web application.  Their domains cannot be compatible. I belive this is logged from SPSite.ValidateDomainCompatibility. Can you verify that I'm not supposed to be able to call across Web Applications by design. Is there some setting that I can change to allow this? Thanks in advance /Jonas Nilsson
  • Anonymous
    April 25, 2007
    In WSS v2 the XSL, Parameters, and Data Source were exposed in the Data View properties web part editor directly from the web interface.   In the WSS v3 implementation of the Data View (form?) Web Part the Data Source Editor is missing (from the web based web part editor).  This is a real disappointment.  How might a user best edit the Data Source of a Data View Web Part without opening up SPD? Thanks for the great post!

  • Anonymous
    April 25, 2007
    Eray, Great article - I hope to test it out shortly.  Since you identified yourself as leading the development for the Application Templates for Windows SharePoint Services 3.0, I’m sure you might be interested in my issue below.  I have posted it on several MS/other web sites and received not response... To Whom It May Concern: Could someone help me or direct me to the right resource to investigate this issue regarding a SharePoint 2003 Application Template... While working in the SharePoint 2007 environment and using the Application Template "Budgeting and Tracking Multiple Projects", I was adding "% Complete" to the "Project Milestones" list in order to add a Gantt View.  When trying to ADD a new Milestone, only the default columns appear and "% Complete" does not appear.  This defeats the purpose of a milestone list to show progress.  I have tried this in 2 environments and have concluded this is either a major BUG in the "Project Milestone" list or the "Budgeting and Tracking Multiple Projects" template.  How do issues like these get resolved and/or identified to Microsoft? Thank-you for your help, Rod

  • Anonymous
    April 30, 2007
    I have an interesting observation regarding the DataFormWebPart in WSS 3.0.   I have been using the web part successfully creating online reports on an issues list.  When I use the "Group By" feature on fields such as Issue Status, I can get a nice total using an xsl function such as count($nodeset) or sub counts with count($nodeset[@Status='Resolved']).  However when I "Group by" the field "Created By" I ALWAYS get 0 for count($nodeset).  This makes it impossible to report on activity based on the Author of an Issue.  Is this a bug?  Can anyone suggest a workaround? Thanks in advance for any help on this matter!

  • Anonymous
    May 08, 2007
    Great article, thanks this clears up a lot. Iis there any way to create the datasource (pointing to a list) without using the GUID of the datasource? Such as using the name or url. We would like to use the Data View webpart in a template that would point to different lists, and a GUID makes it rather difficult for anyone but developers to set. I found a reference to an undocumented ListName parameter but am having trouble getting it to work. Another idea I had was using the CrossList to fake out Sharepoint and somehow get it to look at only one List. This is a huge issue for us and no one seems to have the answer. thanks Chris chrisb76@yahoo.com

  • Anonymous
    May 08, 2007
    Jonas –  Yes, you’re not supposed to call across Web Applications; unfortunately, there isn’t a setting to change this.   Tim G. – You won’t be able to edit the DataSource of a DataFormWebPart without opening SPD, is there a particular reason why you want to avoid opening up SPD? =)  If you’re concerned about customizing a page, you could edit the page in SPD, and then select the option to “Reset to site definition”. Rod – The easiest way to get this to show up is:   1.) Go to list settings --> Advanced Settings and select “allow management of content types   2.) Click on the content type, and then select “Add from existing site or list columns” This behavior is caused by the hidden=”true” setting on the content type definition feature.   As for your general question on how these issues get resolved or identified -- the Application Templates for WSS are a supported product so you can go through Microsoft’s Support Services: http://www.microsoft.com/services/microsoftservices/srv_support.mspx James – For People fields, the SPDataSource returns the entire HTML blob necessary to render as a hyperlink with presence information.  The presence information is actually unique on a per-item basis even if it refers to the same person.  The generic workaround for these sorts of issues is to do the grouping comparisons using the substring function to trim after the person’s name – for example something like this:  substring-before(@Author,'&lt;/A&gt;').   Chris – Yes, in addition to using a ListId, you can also specify a ListName which takes the displayname of a list:   <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="<View></View>" id="Announcements1">  <SelectParameters>    <WebPartPages:DataFormParameter Name="ListName" ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Announcements"/>  </SelectParameters> </SharePoint:SPDataSource> Also make sure you have a matching entry in the parameter bindings section: <ParameterBinding Name="ListName" Location="None" DefaultValue="Announcements"/> It’s also worth noting that we do support ListId fixup in STPs as long as the GUID is wrapped in curly braces:    DefaultValue="{E7C01128-5BAD-4331-BE8E-EABC5CBE7542}" There’s a known issue that we’re investigating that SPD doesn’t always spit out curly braces around the GUIDs.  You’ll want to double check that the ListID is correctly wrapped in the SPDataSource’s parameter collection, the DFWP’s parameter bindings, and if you inserted the DFWP into a web part zone, there may also be a ListName attribute on the DataFormWebPart tag.   thanks, -- eray

  • Anonymous
    May 09, 2007
    Thanks I got that working and can change the list it points to in the Parameters section when I select "Modify Shared web part" (obviously changing to a list of the same Content Type). One last thing, do you know any way to put in relative URLs? :) It seems that's the million dollar question. Our client department wants to store a list on a parent site (the template for this site will have the list) and put this in a meeting workspace template so it will automatically show up. Sharepoint does not seem to like using ".."  There must be some template call somewhere I imagine. Otherwise our second choice is creating a web part using a GridView or SPGridView, since I could easily just parse the url in there. thanks

  • Anonymous
    May 10, 2007
    Chris – There are a lot of ways to do relative urls: Server Relative URL:     <asp:Parameter Name="WebUrl" DefaultValue="/subweb"/> Site Collection Relative: This is in context of the site collection root for the opened web.  For example, assume my site collection root is:  http://server/sites/sitecollection/ This parameter opens this web: http://server/sites/sitecollection/subweb2     <asp:Parameter Name="WebUrl" DefaultValue="subweb2"/> Site Collection Root itself:     <asp:Parameter Name="WebUrl" DefaultValue="{sitecollectionroot}"/> Alternatively you can also use WebID.     <asp:Parameter Name="WebId" DefaultValue="SomeGuid"/> These parameters are compatible with both the ListId and ListName parameters. Now about that million dollars....  :) thanks, -- eray

  • Anonymous
    May 15, 2007
    Is it possible to insert a list item using the DataFormWebPart from another site in the collection? I tried setting the WebURL parameters, but I get an unspecified error when I view the page and the controls do not preview in SPD. I created the custom form in the correct site, then copied the code to a page in a site above where the list exists. Is there another way? I can get it to work using the data source control and binding to asp.net controls.

  • Anonymous
    May 17, 2007
    Its great that you can specify the ListName as the SelectParameter is SPDataSources. By default SPD created the data sources using the Guid, and these break down when exported to a different server. Using the ListName rather than the Guid ensures that the DataSource still works when it is exported. Thanks

  • Anonymous
    May 17, 2007
    I'm no developer, let me make that clear :) - But I'm seeing some odd things happening while using SPD and trying to make data form views.

  1. If I use the ListID parameter, which uses the GUID of the list, I continually get errors telling me that the list no longer exists. After clicking OK I'm still able to make the changes I need and the view (sort of) works. These problems go away if I manually change the code to use ListName instead of ListID.
  2. SPD is tossing in a total of 4 separate sets of <WebPartPages:DataFormParameter> which makes for a lot of extra changes when I use ListName in place of ListID. Also, if I change the parameters using the UI (Common Data View Tasks -> Parameters) not all of those DataFormParameter sets is updated and I have to go back and manually fix them.
  3. Sometimes when applying Sorts and Groups the code is generated incorrectly and the connection is broken. Also, some of my colums don't show up in the list of available fields until I build the expression manually. Yet, those same fields show up fine in other screens, such as "edit columns". Any thoughts on this? It seems to me these weird things shouldn't be happening... They're really starting to tick me off as well. :(
  • Anonymous
    May 18, 2007
    The comment has been removed

  • Anonymous
    May 19, 2007
    Hi Eray, I assume you haven't got your million dollars yet :p From what I have read above, it seems like you can: 1 - access lists across sites in the same site collection. 2 - not access lists across web applications because we're not supposed to do it. My question is: Can you access lists in the same web application but across different site collections? I don't have a million dollars but I would express much gratification :) Dave

  • Anonymous
    May 22, 2007
    Hi, I am also using Budgeting and Tracking Multiple Projects template. We have a requirement to create a subsite for each project and some how rollup all the tasks,  issues for all the projects on the top level site so that the management team can see a real dashboard view of all the projects and related tasks. Each of the project team members can enter their tasks and issues on the project subsite. How do I achieve this functionality using Dataview webpart? Thanks

  • Anonymous
    May 24, 2007
    The comment has been removed

  • Anonymous
    May 29, 2007
    Thanks for the much needed tips ... Where can I find a complete reference of FieldRefs? I am having problems with html fields... What I want is the html blob but this is what I am getting AssignedTo -> 7;#Ólafur Bergsson How can I get the links and html blobs to be rendered? BTW: I am using a crosslist SPDataSource, selecting my uncompleted tasks... Are there any better reference sites than the sparse documentation on MSDN? Thanks, Ólafur Bergsson

  • Anonymous
    May 30, 2007
    Hi, I have a workflow that is is intended to move a document from a secured document library (source) to a publicly viewable document library (target) when the document's status changed to 'published'. This works fine the first time but fails the second time as the COPY LIST ITEM item fails because the document is already in the target document library, which is no good as I want the document overwritten with the updated version. So I added a delete action to the workflow. However the workflow fails when run for a new document that is set to published. This is because it cannot find the document in the target library to delete. How can I make the absence of the document in the target library non-fatal for the workflow or alternatively how can the COPY LIST ITEM be made to overwrite? Apologies if this is the wrong place to post!

  • Anonymous
    May 31, 2007
    Eray, I am trying to create a DataForm in a site while using a Data Source form a different site(both subwebs) but only the DataView is available. The DataForm option is only available when the Data Source in in the same site. The Data Sources I am using are basic Sharepoint lists. Is it not possible to use a DatForm for editing a Data source across subwebs? I must be missing the obvious! Thanks

  • Anonymous
    June 14, 2007
    Hi!

  1. It would be nice to add designer support for FieldRef attribute LookupId="TRUE". You can use it when you want to display Order and all OrderItems (OrderItem has lookup column to Order).
  2. Please, fix bug in ddwrt:URLLookup described here: http://www.eggheadcafe.com/software/aspnet/29871868/data-form-web-part-ddwrt.aspx Is it possible to insert old DataViewWebpart? It could be workaround for this bug. Thanks Martin
  • Anonymous
    June 18, 2007
    hi, DATTARD, did you find a way to solve your problem? i have a smiliar situation, im building a sales portal with informationa bour clients and different projects, i have a main list where i have all my clients information, and for each item in that list i create a site with the clients name. Whay im trying to do, is that the clients site main page displays the information about the client. im trying to use a dataview, but im stucked in sending the site name or any value as a parameter so the dataview will know what information to show. (query string is not an option, since it can be modified by the user, and im not sure how to add the query string to the menus and navigation links) Whay i would love is if i could use a field in the page or the site name as a parameter to the dataview. is it possible?

  • Anonymous
    July 04, 2007
    This article helped me a lot when trying to filter DataSources dependend on a query string variable (good hint with the curly braces!). Thank you for that. Now I would like to use QueryStringParameters in other parts of the aspx-File. By accessing the parameters I could easily hide forms with xsl (xsl:when). But I can't figure out how to use the same parameters in XSL-Tags. How can I access query string variables there? Is it possible at all?

  • Anonymous
    July 09, 2007
    thanks for this great information but i think the dataview need more detailed documentation for its functionality with samples. because it is powerful and few number of devs know how to use it

  • Anonymous
    July 26, 2007
    So I have been on the road for quite a while and hopefully will now finally get some time to start getting

  • Anonymous
    August 02, 2007
    Hi, I've some problem with Custom "New Form" when you have list with multiple content types.

  1. In SPD you choose ContentType for New Form. It works fine, it generates appropriate field controls.
  2. If you choose non default ContentType, save item is always saved as default ContentType. A) I've tried to add ContentType field to form. Field is rendered correctly but the selected value is not saved. <SharePoint:FormField runat="server" id="ff8{$Pos}" ControlMode="New" FieldName="ContentType" __designer:bind="{ddwrt:DataBind('i',concat('ff8',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ContentType')}"/> B) I've tried to add ContentTypeId field to form. It doesn't work. C) I've tried to add Insert Parameter <WebPartPages:DataFormParameter Name="ContentTypeId" ParameterKey="ContentTypeId" PropertyName="ParameterValues" DefaultValue="..." />. It doesn't help. Where is the problem? Thanks Martin
  • Anonymous
    August 15, 2007
    How do I create a view that rolls up data from across my site collection?

  • Anonymous
    August 16, 2007
    I'm researching an issue for my sharepoint developer in charge of our ticketing system.  He set up a series of sites for each of our clients.  Each client's site has a tasks list.  There are 8 developers all of whom have tasks assigned to them in various sites.  He has so far been unable to produce for us a page that shows all the tasks across all sites.  Obviously, It's very difficult for us to have to look at each customer's site each day to see what items are assigned to us.   I have to assume that there's something that we're missing.  Is there an example somewhere of a rollup-type list page that we can modify to fit our environment?

  • Anonymous
    August 22, 2007
    I have created a data view on a page on the main site. This calls info from a list on the subsite. Once the user clicks on the link it goes to the displayform item except it is missing the return Source string. Does anyone know where this appended and how to enable this so that when the user clicks close they return to the page on the main site rather than the all items page.

  • Anonymous
    August 23, 2007
    I was able to roll up all task lists from my site collection but I wanted to add sorting a filtering to the list.  I enabled sorting and filtering in the DataFormWebPart using SharePoint Designer but when I view the page and click on a column header, I get the following error within the sorting/filtering menu: "This column type cannot be filtered" This rollup method blows the content query web part method out of the water but I would still like to be able to use the sorting and filtering functions that the DataFormWebPart control offers.

  • Anonymous
    August 25, 2007
    Which of the WSS 3.0 templates are good examples of ListofLists and Crosslist data sources?

  • Anonymous
    August 28, 2007
    I tried following your CrossList example. I have a site and a subsite that have identical document libraries which use an InfoPath form as their document template. In List mode, I the Data View web part displays the data just fine. However, as soon as I change it to CrossList and change the Select Comand, I get no rows returned. Any advice on debugging this? Is there a newsgroup (Partner-only or public) that is monitored more frequently that would be a good place to seek help with this?

  • Anonymous
    August 30, 2007
    Hi, I have a dataviewwebpart with filtering, sorting and grouping enabled for a list. The list has some category columns that are used in filter dropdowns. It seems the filter values in the dropdowns are populated based on the number of records returned in the list. as a consequence some columns like category have repeating values in the them,i.e duplicate entries. It would be nice if the dropdown values like category have only unique values in them. So given the above scenario how should i  modify the xslt for filter columns to achieve the above objective? Is it possible? Example: List records returned in the dataviewwebpart: Field1                  Field2                  Category


Test1                   value1                  Category1 Test2                   value2                  category1 Test3                   value3                  category1 Test4                   value4                  category2 Test5                   value5                  category2 Filter values that are displayed for category at present:     Category dropdown   ->  Category1        Category1        Category1        Category2        Category2 But what is required in the category dropdown: Category dropdown ->  Category1      Category2 If anyone has a solution please help me. Thank you so much.

  • Anonymous
    September 06, 2007
    I'm using the DataView web part (http://schemas.microsoft.com/WebParts/v2/DataView), with a Database connection to Sql, calling a stored procedure, with no parameters. When I turn on "Enable sorting and filtering on column headers (basic table layout only)", the setting is not working. The custom query renders the sorting/filtering drop down links on the column headings, yet neither works. I've done a view source and the fields are set correctly, eg: 'dvt_sortfield={FirstName};dvt_sortdir={' + 'descending' + '}');"  // where FirstName is one of my stored proc field names Am I missing something??? There is no mention of this setting when using SharePoint Designer help - only "Sort and Group", which are not set in my example, and would not provide the ability for the user to click on column headings. Thanks

  • Anonymous
    September 07, 2007
    Is there a way to update the page title of an aspx page in SharePoint based on a value in the Data Form Web Part. I have a Data Form Web Part which shows a single item from a list based on the ID passed on the query string. I would like to use the title field of this list item to set the page title for the current aspx page. Is there a way to pass values from the Data Form Web Part to the page?

  • Anonymous
    September 09, 2007
    The fix for data views to access lists across sites seems top work EXCEPT that  <asp:Parameter Name="WebUrl" DefaultValue="{sitecollectionroot}"/> only works for subsites of the root and NOT subsites of the subsites. The variant    <asp:Parameter Name="WebId" DefaultValue="SomeGuid"/> will clearly work but is not maintainable code due to the coded guid Any advice? None of this seems documented on msdn? Are they "secret" parameters?

  • Anonymous
    September 13, 2007
    Hi all, I am new to the sharepoint 2007 and requried help on SPDataSource. My requriments 1 )Access list data from 2 diffent sit collection and show it on the page.     How it can be done?

  1. I am not able to use CrossList as a DataSourceMode to access the list from same site collection.    can any one provied sample on CrossList ?   (I have achive this by creating linking Source). Please help me. Thanking
  • Anonymous
    September 24, 2007
    Hi all, I am trying to bind the "Type" field from teh document library to my custom SPGridview. I am using SPDatasource in list mode. Can anyone suggest me how to display the corresponding image field according to the type of document. I want to mimic the same behavior as MOSS doucument library. I was able to bind all other field but when i bind the Type field i only get  1 and 0.                            thanks

  • Anonymous
    October 17, 2007
    I’m trying to sort and group people in the DVWP and it doesn’t seem to work.  It’s because the people (or is it person?) data type contains all of the chrome for rendering presense, etc. and so sorting an grouping don’t work as expected.  This is such a common behavior that people would want to do that I have to believe that someone has already come up with a suitable workaround.   I saw that you said to trim the extraneous HTML, and I did that, but it didn't solve the sorting and grouping problem ... BTW, filtering is also broken for person data types.   Is there a workaround, or something that I'm missing?  Thanks, Dave.

  • Anonymous
    November 02, 2007
    Do you have an example using the asp:SqlDataSource against a stored proc with parameters? This worked in 2003 and I cannot get it to work in 2007. SPD does not save the parameter values I enter.

  • Anonymous
    November 04, 2007
    Hi all Thabk you for the great article. I am using a DataFormWebPart, and I put filter on ut using query. My web part perform filtering on three fields:Title,DocNo and ORG by "And" Connective between them. I pass the user's entries to the <Query></Query> using three parameters.But when one of the entries is empty the result data is nothing.I tried to use <Switch> in <View> element but it seems that <Switch> is not allowed in <View>. What do you suggest I should do? (I mean some way except usimg object model and no to hamdle this problem programmaticaly) Thanks alot.

  • Anonymous
    November 09, 2007
    Dremillard, Have you ever figured out a solution to this? I am trying to achieve the same thing but having no luck with it. Also the filter dropdowns are screwy too Thanks

  • Anonymous
    November 13, 2007
    Dataview webpart is a great tool, but it has one major flaw. Aggregating data from the whole site collection is a basic function in CQWP, but in dataview you have to write to code to do the same. Why can't there just be equal settings like in CQWP?

  • Anonymous
    November 23, 2007
    Chad, No, I never figured it out ... or found any reference to a solution.  It would be nice to get a reply.  Eray, are you still there?   Dave.

  • Anonymous
    November 29, 2007
    Is there a solution for the Filter drop down not showing unique enteries? I have a multivalue lookup field in a dataview and want to send the information to another dataview which has the lookup list.  I want to filter the lookup list based on the value coming from the multivalue column? Murad.

  • Anonymous
    December 07, 2007
    Kumar and Murad, I was having the same issue where the filter would apply to the exact string of the column.  So if you had a multi select column with say values a, b, c filtering by 'a' would filter out this item.  The xsl variable dvt_filterval is what contains the value.  By making some changes to the assignments of dvt_FilteredRowsText, dvt_FilteredRows, and dvt_FilteredRowsAttr I was able to make it so that if the column contained dvt_filterval within the column it would not filter it out.  Here are the changes: <xsl:variable name="dvt_FilteredRowsText" select="$Rows[contains(.,$dvt_filterval) or ($dvt_filtertype='date' and substring-before($dvt_filterval,'T') = substring-before(.,'T'))]" /> <xsl:variable name="dvt_FilteredRows" select="$Rows[contains(normalize-space([name()=$dvt_filterfield]), $dvt_filterval) or ($dvt_filtertype='date' and substring-before($dvt_filterval,'T') = substring-before(normalize-space([name()=$dvt_filterfield]),'T'))]" /> <xsl:variable name="dvt_FilteredRowsAttr" select="$Rows[contains(normalize-space(@[name()=$dvt_FieldNameNoAtSign]), $dvt_filterval) or ($dvt_filtertype='date' and substring-before($dvt_filterval,'T') = substring-before(normalize-space(@[name()=$dvt_FieldNameNoAtSign]),'T'))]" />

  • Anonymous
    December 11, 2007
    To make it so that filter fields populated with unique values it took quite a bit of custom xslt.  The multi select columns I used were Lookup types that used existing lists.  So to be able to populate those values into a drop down you first have to add them in as data sources so that they are available in the xml.  Then to make sure they don't show up in the DataFormWebPart display you have to filter them out of the Rows variable.  My list's name was Products so the Rows assignment looks as follows: <xsl:variable name="Rows" select="/dsQueryResponse/Rows[@source !='Products']/Row" /> Then create a new variable with the Rows you want visable in the drop down <xsl:variable name="Products" select="/dsQueryResponse/Rows[@source = 'Products']/Row" /> The template dvt.filterfield is what populates the filter fields so you will have to pass the new variable to this filter instead of Rows.  You'll also have to custimize which field in the list the drop down is populating on.  If this field is named different then the fields in the lists being displayed in the DataFormWebPart you want the filter to populate on you'll have to write a custom filterfield template which is what I did.  My custom filter field has an extra field in it called targetfieldname so that it knows what field to apply the filter to since it is different then field populating the drop down.  Title is the field being used to populate the drop down in my case.  Here is the call to the custom template: <xsl:call-template name="dvt.customfilterfield">     <xsl:with-param name="fieldname">@Title</xsl:with-param&gt;     <xsl:with-param name="fieldtitle">Products</xsl:with-param>     <xsl:with-param name="targetfieldname">@Products</xsl:with-param&gt;     <xsl:with-param name="Rows" select="$Products" />     <xsl:with-param name="fieldtype">text</xsl:with-param> </xsl:call-template> And here is the template being called: <xsl:template name="dvt.customfilterfield">     <xsl:param name="fieldname" />     <xsl:param name="fieldtitle" />     <xsl:param name="targetfieldname" />     <xsl:param name="Rows" />     <xsl:param name="fieldtype" />                         <xsl:variable name="dvt_FieldNameNoAtSign" select="substring-after($fieldname, '@')" />                         <xsl:variable name="filtertype">          <xsl:if test="starts-with($fieldtype,'date')">date</xsl:if>     </xsl:variable>     <xsl:variable name="sorttype">     <xsl:choose>         <xsl:when test="starts-with($fieldtype,'number')">number</xsl:when>         <xsl:otherwise>text</xsl:otherwise>     </xsl:choose>     </xsl:variable>                     <xsl:variable name="clientText">&apos; + this.options[this.selectedIndex].value + &apos;</xsl:variable>                     <xsl:if test="not(contains($fieldname, '/')) and not(contains($fieldname, '['))" ddwrt:cf_ignore="1">                      <xsl:value-of select="$fieldtitle" />                       <xsl:text disable-output-escaping="yes">:&lt;br&gt;</xsl:text>                      <select name="{$fieldtitle}_filterval">                        <xsl:attribute name="onchange">                          javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('NotUTF8;dvt_filterfield={@',$fieldtitle,'};dvt_filtertype={',$filtertype,'};dvt_adhocmode={false()};dvt_filterval={',$clientText,'}'))" />;                        </xsl:attribute>                        <option value="##dvt_empty##">                          <xsl:if test="$dvt_filterfield=$fieldname and $dvt_filterval=''">                            <xsl:attribute name="selected">true</xsl:attribute>                          </xsl:if>                          (Empty)                        </option>                        <option value="##dvt_all##">                          <xsl:choose>                            <xsl:when test="not($dvt_filterfield)">                               <xsl:attribute name="selected">true</xsl:attribute>                            </xsl:when>                            <xsl:when test="$dvt_filterfield!=$fieldname">                               <xsl:attribute name="selected">true</xsl:attribute>                            </xsl:when>                          </xsl:choose>                          (All)                        </option>                        <xsl:value-of select="ddwrt:NameChanged('',1)" />                        <xsl:choose>                           <xsl:when test="starts-with($fieldname, '@')">                             <xsl:variable name="dvt_Rows">                               <xsl:for-each select="$Rows">                                 <xsl:sort select="@[name()=$fieldname]" order="ascending" data-type="{$sorttype}" />                                <xsl:copy-of select="." />                              </xsl:for-each>                            </xsl:variable>                             <xsl:for-each select="msxsl:node-set($dvt_Rows)/[not(@[name()=$dvt_FieldNameNoAtSign]=preceding-sibling::[1]/@[name()=$dvt_FieldNameNoAtSign])]/@[name()=$dvt_FieldNameNoAtSign]">                               <xsl:sort data-type="{$sorttype}" />                               <xsl:call-template name="dvt.filteroption">                                 <xsl:with-param name="name" select="$targetfieldname" />                                 <xsl:with-param name="value" select="." />                                 <xsl:with-param name="type" select="$fieldtype" />                               </xsl:call-template>                            </xsl:for-each>                          </xsl:when>                           <xsl:when test="$fieldname = '.'">                             <xsl:variable name="dvt_Rows">                               <xsl:for-each select="$Rows">                                 <xsl:sort select="." order="ascending" data-type="{$sorttype}" />                                <xsl:copy-of select="." />                              </xsl:for-each>                            </xsl:variable>                             <xsl:for-each select="msxsl:node-set($dvt_Rows)/[not(.=preceding-sibling::[1])]">                               <xsl:sort data-type="{$sorttype}" />                               <xsl:call-template name="dvt.filteroption">                                 <xsl:with-param name="name" select="$targetfieldname" />                                 <xsl:with-param name="value" select="." />                                 <xsl:with-param name="type" select="$fieldtype" />                               </xsl:call-template>                            </xsl:for-each>                          </xsl:when>                           <xsl:otherwise>                             <xsl:variable name="dvt_Rows">                               <xsl:for-each select="$Rows">                                 <xsl:sort select="[name()=$fieldname]" order="ascending" data-type="{$sorttype}" />                                <xsl:copy-of select="." />                              </xsl:for-each>                            </xsl:variable>                             <xsl:for-each select="msxsl:node-set($dvt_Rows)/[not([name()=$fieldname]=preceding-sibling::[1]/[name()=$fieldname])]/[name()=$fieldname]">                               <xsl:sort data-type="{$sorttype}" />                               <xsl:call-template name="dvt.filteroption">                                 <xsl:with-param name="name" select="$targetfieldname" />                                 <xsl:with-param name="value" select="." />                                 <xsl:with-param name="type" select="$fieldtype" />                               </xsl:call-template>                            </xsl:for-each>                          </xsl:otherwise>                        </xsl:choose>                        <xsl:value-of select="ddwrt:NameChanged('',1)" />                       </select>                    </xsl:if>                  </xsl:template> Hope this helps

  • Anonymous
    January 07, 2008
    WebURL Parameter and Drop Down Filter Problem: I'm using a DataFormWebPart (with sorting and filtering enabled) to display data from a custom list. Without the WebURL Parameter everything works fine, but the usage of the web part is limited to the web containing the custom list. To use it in a parent web of the custom list I tried to work with the WebURL parameter. But as soon as I use this parameter the drop down filters on the column headers won't work. The drop down opens and with some delay the following message appears: "This column type cannot be filtered" Am I missing something? Is this by design or is it a bug? Thanks for any help, Roni

  • Anonymous
    January 08, 2008
    Hi Roni, There are some issues with gettng the schema when you use the WebURL property. Instead of doing that route, can you try using manage catalog? Open the parent site in SPD Click on Task Panes > Data Source Library Click on Connect to other library (this is from memory, so that may be the wrong string) Type in the URl of the child site with the custom list. Click OK Expand that library Insert a view of the Custom List Data View..Change Layout :: General tab Enable sort/filter on column headers. Click OK Save the page

  • Anonymous
    January 08, 2008
    i need to develop a dynamic selectcommand in sharepoint designet is it posiblle? actually my senario is that i want to do some filtering on the bases of query string variables Note: there are more then one variable and i want when they are not null then some filter apply on my dataview web part Please help me out.

  • Anonymous
    January 09, 2008
    Thanks spdblog for your quick answer. Your description is more or less exactly what I did. With these steps SPD will automatically insert the WebURL Parameter which will cause the problems with the drop down filters.

  • Anonymous
    January 09, 2008
    The comment has been removed

  • Anonymous
    January 09, 2008
    Thanks John. I tried to follow the mechanism behind (post back, java script, ...) and assumed something like that. The toolbar isn't that nice but we will see. Roni

  • Anonymous
    February 13, 2008
    Does the SelectCommand CAML work when using ListName (list display name) instead of ListID (list GUID)?  I can't seem to get a simple filter (WHERE) to work.  It throws the error:  "The server returned a non-specific error when trying to get data from the data source.  Check the format and content of your query and try again.  If the problem persists, contact the server administrator."

  • Anonymous
    February 25, 2008
    Hi: I need to create a view where i could filter items based on person field (multiple selection). I tried this in SP designer, but i can't create dataview with filter on this field. Please help. Regards --Vinay

  • Anonymous
    March 03, 2008
    I would GREATLY appreciate any tips on how to do a Calendar rollup much like this Data View rollup... I'm on day seven and still having massive difficulties in both research and attempts to do so.  The logic is, if a Calendar view can be created for any list (with included date fields), then why can't a MASTER Calendar view be created with its source as being recursive of all the other lists?

  • Anonymous
    March 06, 2008
    Thank for your post. I would like to know if there is any possibility to sort data list  by group count. I mean group by some column and get count of each group, then sort by the count of the group. E.g. Group A  (1) A Group B  (2) A B Group C (3) A B C Any tips, I greately appreciate.

  • Anonymous
    March 11, 2008
    The comment has been removed

  • Anonymous
    March 18, 2008
    The issue is the <webs></webs> tag needs to be inside the <view></View> tags.  That does the trick

  • Anonymous
    March 18, 2008
    hmmm.  Just finding this thread.   I'm trying to 'link' related docs in some maintable way.  Each document has an ID. We want to file requirements in one folder, specs in another, and change requests in a third etc.  Short of adding a cross-ref field to each item with all of the other document ids in it (which is subject to human error)  could we use this cross-list method of creating a 'roll-up' DL that related docs together?   We could do this with search, but again, this would be subject to fishing through a string field for a value someone easily could ruin.  Anyone have experience or advice on how to accomplish this without rekeying each related doc in each docs properties? thanks

  • Anonymous
    March 27, 2008
    Firing the CrossList Query returns result like <rows>    <row>        <ListId>0F4344D9-37EE-4732-9B13-B6F3BAF38F91</ListId>        <WebId>617FE4B1-A040-4BE5-9B55-70B34B8A8AC4</WebId>        <ID>1</ID>        <Title>Item 1</Title>    </row>    <row>        <ListId>A1D55E58-9AAF-4aeb-9CCE-6946D57A0399</ListId>        <WebId>945FF040-B086-5BY7-0A55-50B67B9C4ACC</WebId>        <ID>2</ID>        <Title>Item 1</Title>    </row> </row> Its possible to print Item Title using @Title as <xsl:value-of select="@Title"/&gt; I also want to show from which site that item belongs to If I try <xsl:value-of select="@WebID"/&gt; It displays that ugly GUID on screen. My question is How to show Site name , not its WebID ( GUID ) For E.g I want to show |Title              | Site


|Item 1           | Finance |Item 2           | Marketing Also how can we generate URL of that site using GUID ? so I can give hyperlink too.

  • Anonymous
    March 30, 2008
    how to save DataFormWebPart by savewebpart method of sharepoint webservices..  from "_vti_bin/WebPartPages.asmx" ?

  • Anonymous
    March 31, 2008
    How to query cross-site lists in DataFormWebPart - Part 1. Build your own data source for DataFormWebPart

  • Anonymous
    April 03, 2008
    Is there a way to display items in the DataFormWebPart from a list in a different site (also separate web app)? If not, is there an alternative web part that can be used to achieve this?

  • Anonymous
    April 08, 2008
    The SPDatasource is easy to use and works fine all the time. BUT it doesn't return the internal IDs of LookUpField entries. It just returns the titles of the LookUpField entries. Why? This is not clear to me. To get the internal IDs of assigned entries in a LookUpField I have to use a SOAPDatasource instead. This returns the internal IDs. BUT the SOAPDatasource doesn't work all the time in my environment. We use HTTPS company wide. Sometimes I have to use WsdlPath="https://[SERVER] sometimes WsdlPath="http://[SERVER] to get it work. Sometimes nothing works. I think it's a configuration problem of our web servers. But I do not understand why the tool u2u CAML builder works fine and all the SPDatasources too. I'm not able to work in this way.

  • Anonymous
    April 11, 2008
    I wanted to use a template from Application Templates for Windows SharePoint Services 3.0 but I am not the main site admin. Actually I am the admin of lower site (or subsite). Mainly I wanted to learn how to come up with a view like the one displayed for a project from the project list in the IT template. I would hope that in the future we do not have o depend on the "higher admin" to enable nice features on the "lower sites". In the meant time anyway I can learn to create that view (It shows the project list then the related tasks and milestones and issuess). Thank you.

  • Anonymous
    April 21, 2008
    I use Countent Query Webpart to gather the projecttask from my other subsites. I'm gouping them by the sites. In the result list I need to print the item count for each group, like: Group1 (2) A B Group2 (1) D Can anybody help? Thanks

  • Anonymous
    April 30, 2008
    Hi, I have successfully built a dataviewwebpart with filtering, sorting and grouping for a list to show total counts of a particular status. The list has people's names, the department they work in, and their status with regards to present or absent.  In the dataview I then display for each department the total amount of people either present or absent.  The resultant table looks something like this: Department          Present          Absent HR                       4                   1 Sales                    6                   2 Shipping              10                 1 My problem is when there is no one of a particular status, rather than showing a zero in the Status count, it shows nothing, like this: Department          Present          Absent HR                       4                   1 Sales                    6                   2 Shipping              10                 My question is how to show the zero when there is an empty count for that department row? Regards, Nestor

  • Anonymous
    May 01, 2008
    Hi Nestor, I am trying to achieve the same kind of report in my main site, where i am pulling data from the lists in subsites. can you please tell me how to do that. I would really appreciate any help. You can email me at nituagg@yahoo.com, if you prefer... Thanks...

  • Anonymous
    May 06, 2008
    Hi Nitu, (I'm posting here just because other people might have the same question.) The way I did it was to create three list DataViews side-by-side, only showing the Department or the particular status field.  I then Applied a status filter and under Sorting and Grouping selected show Footer, but under Advanced grouping I selected to "Hide Details".  This prevents all the people's names from showing up.  Hope this helps. Nestor

  • Anonymous
    May 13, 2008
    I am having the same problem as stated above by Grayden on August 31, 2007 1:29 AM. Pretty simple stuff here.  I have a DFWP bound to a SPSqlDataSource where SelectCommandType="StoredProcedure".  The stored procedure is very simple, taking no arguments, returning a couple columns from a single table. The headers, when clicked perform a postback, but no sorting occurs. Running similar tests, if I use sql for the selectcommand, even with parameters, sorting works fine. I've seen a few posts on this in various places, but no solution.  Any ideas?

  • Anonymous
    May 16, 2008
    Nirav, did you find a solution to your issue yet?  I have the same question - how do you display the name of the site a list item is from in a crosslist query?

  • Anonymous
    May 29, 2008
    Hi I have a list in which i stored some report types and the urls for reports. i have created a dataview in which i retrieved all the information from one datasource(Custom List) now i want to fetch the url of that pirticular Report type in the list. can it be possible through crosslist? Thanks... Shaun

  • Anonymous
    June 04, 2008
    Hi Shawn the code for removing duplicate values in Filter fields in dataview webpart is not working. please give me anyother solution regards muthu

  • Anonymous
    June 25, 2008
    The comment has been removed

  • Anonymous
    July 06, 2008
    The comment has been removed

  • Anonymous
    July 14, 2008
    SPDataSource - a refresher So last time in part 1 of this 2-part series, we saw how SPDataSource is a

  • Anonymous
    July 17, 2008
    I just can't get this to work. If I follow this example through when I save the page the data source tab that show the rows increases the row count but only the following fields appear : ListId, WebId and Id. Is this because I have not specified the ServerTemplate attriibute ? Even adding the server template does not fix it. This is the xml snippet I'm using:- <DataSources> <SharePoint:SPDataSource runat="server" DataSourceMode="CrossList" UseInternalName="true" selectcommand="<Webs Scope='Recursive'></Webs>&lt;View&gt;&lt;/View&gt;" id="Announcements1"><SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="65DA41BF-7F20-4371-9E72-C96DE3A54C3E"/></SelectParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="65DA41BF-7F20-4371-9E72-C96DE3A54C3E"/></DeleteParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="65DA41BF-7F20-4371-9E72-C96DE3A54C3E"/></UpdateParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="65DA41BF-7F20-4371-9E72-C96DE3A54C3E"/></InsertParameters></SharePoint:SPDataSource> </DataSources> <ParameterBindings>   <ParameterBinding Name="ListID" Location="None" DefaultValue="65DA41BF-7F20-4371-9E72-C96DE3A54C3E"/>   <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>   <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>   <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>   </ParameterBindings> <datafields>@ID,ID;@ContentType,Content Type;@Title,Title;@Modified,Modified;@Created,Created;@Author,Created By;@Editor,Modified By;@_UIVersionString,Version;@Attachments,Attachments;@File_x0020_Type,File Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@_HasCopyDestinations,Has Copy Destinations;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;@Body,Body;@Expires,Expires;</datafields&gt; Hopefully you can shed some light. Thanks J.

  • Anonymous
    July 21, 2008
    Hi Eray thanks for a wonderful post, the last section of your post "Create a view that shows all announcements in the site collection" has few things to take care in SPD i.e. in the SELECTCOMMAND we need to add the tags as you have explained in earlier section of the blog. i.e. the SELECT COMMAND would look like: SelectCommand="<Webs Scope='Recursive'></Webs> <Lists ServerTemplate='104' BaseType='0'></Lists> <View> <ViewFields> <FieldRef Name='ID'/> <FieldRef Name='ContentType'/> <FieldRef Name='Title'/> </ViewFields> </View>" And then it will render the data from all announcements lists in the site collection. Your post is really very helpful and I would like to add the above comment so that other users will get it working.

  • Anonymous
    August 07, 2008
    SPDataSource - a refresher So last time in part 1 of this 2-part series, we saw how SPDataSource is a

  • Anonymous
    August 08, 2008
    The comment has been removed

  • Anonymous
    August 08, 2008
    ^^^^^^^^^^^^^^  A YEAR LATER ^^^^^^^^^^^^    The guys is still wondering how to resolve his issue.  WOW.

  • Anonymous
    September 02, 2008
    One of the most powerful new OM calls in Windows SharePoint Services v3 is the GetSiteData method on the SPWeb object. This method makes it possible to query for items across multiple lists in multiple Web sites in the same site collection. This is most

  • Anonymous
    September 08, 2008
    Nirav, did you find a solution to your issue yet?  I have the same question - how do you display the name of the site a list item is from in a crosslist query? kindly send the solution to my mail id mmsanthosh@hotmail.com....

  • Anonymous
    September 16, 2008
    A Data View Web Part (DVWP) that displays a dropdown can be a useful tool to drive navigation.  See my previous post about showing content archives (Displaying an Archive for a SharePoint List) as an example. If you have a decent number of items in the list you are using, you will likely end up with duplicates in your dropdown, which isn't really what you want.  Here's the trick to remove the duplicates. When you add your DVWP, add your column for the dropdown, and set your DVWP layout to a dropdown view type, you will get a chunk of code like the following: <xsl:template name="dvt_1.rowview">  <option>    <xsl:attribute name="value">      <xsl:value-of select="@Your_x0020_Column&quot; />    </xsl:attribute>    <xsl:value-of select="@Your_x0020_Column&quot; />  </option> </xsl:template>Find this code, and change it as follows: <xsl:template name="dvt_1.rowview">    <xsl:variable name="NewGroup" select="ddwrt:NameChanged(string(@Your_x0020_Column), 0)" />    <xsl:if test="string-length($NewGroup)">        <option>            <xsl:attribute name="value">                <xsl:value-of select="@Your_x0020_Column&quot; />            </xsl:attribute>            <xsl:value-of select="@Your_x0020_Column&quot; />        </option>    </xsl:if> </xsl:template>The ddwrt:NameChanged function will return a value only when the value of the column has changed since the last new value. Next up: How to make something happen when the user selects a value from the dropdown.

  • Anonymous
    September 24, 2008
    I am attempting to share list data featuring a calculated column via a Data View Web Part (DVWP).  The DVWP was created on a different site by accessing the list data via a shared library connection.  Upon inserting the desired fields as a Mulitiple Item List, I see all of the data except for the calculated column data.  Oddly enough, if I insert a formula into the blank calculated field column that simply references the pertinent field name, the data is revealed.  Why wouldn't it show this data immediately after inserting the fields? Curious, Pat

  • Anonymous
    September 24, 2008
    Potentially related to the aforementioned DVWP data display issue, I also attempted to replicate the Cross List rollup solution cited by Eray in his initial posting.  While I was able to generate a DVWP featuring a number of rows corresponding to the number of sites with the Announcements web part, all of the fields in the DVWP were blank.  In light of my previous post, could this be due to a security or configuration setting?  If so, where should I be looking to resolve this issue? Thank you! Pat

  • Anonymous
    September 30, 2008
    Hi all, I have a question pertaining to a data view.  I am inserting a single item form from a data view that gives users the ability to insert, edit, and deletea a record.  The database connection is on SQL Server 2000.  I was curious if Sharepoint has a built in function that allows me to insert a modified by and modified date columns to each record.  I want to track these fields for every change that is made to the data in the tables. Is this only a function of a workflow? And is a workflow something I should be doing to allow users to edit/update/insert data into this table.   Also, when an insert/update/delete command is used in a single item form, is there a way to show a confirmation window saying that a record has been updated/deleted/inserted successfully. Thanks in advance for the help. Bobby

  • Anonymous
    October 06, 2008
    I got the Annnouncement lists to rollup, but I cannot seem to get the same behavoir with events lists. My Announcements Data source <SharePoint:SPDataSource runat="server" DataSourceMode="CrossList" UseInternalName="true" selectcommand="<Webs Scope='Recursive'></Webs><Lists ServerTemplate='104' BaseType='0'></Lists>&lt;View&gt;.../View&gt;" id="announcements1"> <SelectParameters><asp:Parameter Name="ListID" DefaultValue="AACC41A6-B555-41CA-8D94-7A5F334B8CE9"/></SelectParameters> <DeleteParameters><asp:Parameter Name="ListID" DefaultValue="AACC41A6-B555-41CA-8D94-7A5F334B8CE9"/></DeleteParameters> <UpdateParameters><asp:Parameter Name="ListID" DefaultValue="AACC41A6-B555-41CA-8D94-7A5F334B8CE9"/></UpdateParameters> <InsertParameters><asp:Parameter Name="ListID" DefaultValue="AACC41A6-B555-41CA-8D94-7A5F334B8CE9"/></InsertParameters> </SharePoint:SPDataSource> My Events Code <SharePoint:SPDataSource runat="server" DataSourceMode="CrossList" UseInternalName="true" selectcommand="<Webs Scope='Recursive'></Webs><Lists ServerTemplate='106' BaseType='0'></Lists>&lt;View&gt;&lt;/View&gt;" id="Calendar1"> <SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="CC75D92E-3E4D-4BCF-8490-D4F8E6E808F6"/></SelectParameters> <DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="CC75D92E-3E4D-4BCF-8490-D4F8E6E808F6"/></DeleteParameters> <UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="CC75D92E-3E4D-4BCF-8490-D4F8E6E808F6"/></UpdateParameters> <InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="CC75D92E-3E4D-4BCF-8490-D4F8E6E808F6"/></InsertParameters> </SharePoint:SPDataSource> The Events code only displays an empty view Thansks James

  • Anonymous
    October 29, 2008
    The comment has been removed

  • Anonymous
    November 04, 2008
    I looked for a solution for this, and it is soooo easy!   Locate the dvt.filterfield template in the Xsl and locate the following xsl:for-each statement: <xsl:for-each select="msxsl:node-set($dvt_Rows)/[not(@[name()=$dvt_FieldNameNoAtSign]=preceding-sibling::[1]/@[name()=$dvt_FieldNameNoAtSign])]/@[name()=$dvt_FieldNameNoAtSign]"> All I did to fix it was remove the [1], like this: <xsl:for-each select="msxsl:node-set($dvt_Rows)/[not(@[name()=$dvt_FieldNameNoAtSign]=preceding-sibling::/@[name()=$dvt_FieldNameNoAtSign])]/@[name()=$dvt_FieldNameNoAtSign]"> found this at: http://www.sharepointblogs.com/abdrasin/archive/2007/12/06/dataviewwebpart-dataformwebpart-with-duplicate-values-in-filter-selection.aspx

  • Anonymous
    December 18, 2008
    Hello everyone, Without any ado....I have a data form webpart bound to an xml web service....and it is having some filtering problems. When i enable the toolbar for sorting/filtering it works fine but filtering does not seem to work on column headers. I have selected the basic table layout . When i click on column header it says "This column type can not be filtered" and is greyed out . Sorting is working fine. Now when it can filter same column types using the toolbar why it can not by column headers??? Wat could be the reason ?? This is how my header code looks like <xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"> <xsl:with-param name="fieldname">SUnN</xsl:with-param> <xsl:with-param name="fieldtitle">SUnN</xsl:with-param> <xsl:with-param name="displayname">SUnN</xsl:with-param> <xsl:with-param name="sortable">1</xsl:with-param> <xsl:with-param name="fieldtype">Text</xsl:with-param> </xsl:call-template> I have googled enough and still dont have any clues about it. Please advice. Thanks in advance

  • Anonymous
    February 09, 2009
    Can cross list SPDataSources be linked to other SPDataSources using WSS 3.0? When you create a linked data source, SP Designer inserts the following script after the DVWP <DataSources> callout: <SharePoint:AggregateDataSource runat="server" IsSynchronous="" SeparateRoot="true" RootName="" RowsName="" ID="Unique_Combo_ID"> <Sources> <SharePoint:SPDataSource runat="server" ... </SharePoint:SPDataSource> <SharePoint:SPDataSource runat="server" .... </SharePoint:SPDataSource> </Sources> <aggregate> <concat name="data source"> <datasource name="List1" id="0" Type="SPList"/> <datasource name="List2" id="1" Type="SPList"/> </concat> </aggregate> </SharePoint:AggregateDataSource> </DataSources> I'm assuming that it is pretty straightforward to swap out the SPDataSource script for a functioning "cross list" data source with the default "list" data source, but I don't know how to specify a dynamic list of datasources for the <aggregate> attribute.  Any thoughts as to how to accomplish this?  Are there any other concerns that I should be aware of when attempting to link cross list data sources? Curious, Pat

  • Anonymous
    March 03, 2009
    Hi, I am not sure this is the right place, but I am desperate. From SharePoint Designer 2007, I am able to connect to AdventureWorks sample database on SQL Server 2005. But from Data Source Library window, when I right click on my "Custom Query" and click "show data" I get this error message: <<The server returned a non-specific error when trying to get data from the data source. Check the format and content of your query and try again. If the problem persists, contact the server administrator>> What am I doing wrong and how do I resolve this issue. Note that SQL server 2005 and MOSS  2007 server farm are running on the same server. SharePoint Designer 2007 is running on a client workstation. Thanks for any help. Nee

  • Anonymous
    April 01, 2009
    Where does this code actually go? I tried to put it in a custom NewForm.aspx page that was working until I put the code in it. It just says the page can not be found once this type of code goes in...

  • Anonymous
    April 01, 2009
    I have the same issue as dremillard posted on Sept 24, 2007: QUOTE:


I’m trying to sort and group people in the DVWP and it doesn’t seem to work.  It’s because the people (or is it person?) data type contains all of the chrome for rendering presense, etc. and so sorting an grouping don’t work as expected.  This is such a common behavior that people would want to do that I have to believe that someone has already come up with a suitable workaround.   I saw that you said to trim the extraneous HTML, and I did that, but it didn't solve the sorting and grouping problem ... BTW, filtering is also broken for person data types.   Is there a workaround, or something that I'm missing?  Thanks, Dave.

Any solutions to this?

  • Anonymous
    April 15, 2009
    I am having an issue using this method to roll-up document libraries. Is it even possible? I have the following: <DataSources><SharePoint:SPDataSource runat="server" DataSourceMode="CrossList" UseInternalName="true" selectcommand="<Webs Scope='Recursive'></Webs> <Lists ServerTemplate='101' BaseType='1'></Lists> <View> <ViewFields> <FieldRef Name='ID'/> <FieldRef Name='ContentType'/> <FieldRef Name='Title'/> </ViewFields> </View>" id="dataformwebpart6"><SelectParameters> I have tried changing the BaseTypes and ServerTemplate which will result in either a set of blank entries or an error message. "The server returned a non-specific error when trying to get data from the datasource. Check the format and content of your query and try again, If the problem persists, contact your server administrator." Anyone have any ideas?

  • Anonymous
    April 23, 2009
    I have a custom aspz page with a dataview webpart with a linkedsource(<sharepoint:aggregatedatasource>).When I am trying to deploy this page using feature I am getting the following error Unable to renderwebpart. How to deploy pages with linked source?

  • Anonymous
    May 13, 2009
    SharePoint支持移动设备通过WAP访问站点和列表(启用Mobile访问功能stsadm-oactivatefeature-nameMobilityRedirect -URL

  • Anonymous
    July 17, 2009
    I am trying to use lists.asmx to return the contents of a Project Tasks list to a DataViewWebPart.  In SharePoint Designer, I can create a Data Source that references lists.asmx, and it returns 17 fields.  Status is not one of those fields.  How do I get lists.asmx to return the status (Not Started, In Progress, Completed) of a task?

  • Anonymous
    July 29, 2009
    I have the same problem as Smartin, Has a fix every been developed for this? http://www.eggheadcafe.com/software/aspnet/29871868/data-form-web-part-ddwrt.aspx

  • Anonymous
    August 14, 2009
    Has anyone solved the issue rised by PJC and Subhasish Bhowmick ? I'm having the very same issue!!!!!!!

  • Anonymous
    September 28, 2009
    I am using Data View Web Part to show data from 22 Doc Libraries in my page. I have enabled the Filter & Sort features of this Web Part. However the 7 Drop Down Filters are having duplicate values. Please find below the code snippet of the page from SPD,     <xsl:for-each select="msxsl:node-set($dvt_Rows)/[not(@[name()=$dvt_FieldNameNoAtSign]=preceding-sibling::[1]/@[name()=$dvt_FieldNameNoAtSign])]/@[name()=$dvt_FieldNameNoAtSign]">       <xsl:sort data-type="{$sorttype}" /> When I remove [1] from it     <xsl:for-each select="msxsl:node-set($dvt_Rows)/[not(@[name()=$dvt_FieldNameNoAtSign]=preceding-sibling::/@[name()=$dvt_FieldNameNoAtSign])]/@[name()=$dvt_FieldNameNoAtSign]">       <xsl:sort data-type="{$sorttype}" /> My page is not rendered. And I still have the dupliactes in the Drop Downs. Please let me know how to get rid of the Duplicate values. Thanks, Salil

  • Anonymous
    October 21, 2009
    I'm reporting the same problem as previously reported but hopefully this comment in October 2009 will bring get someone from Microsoft to reply. Under my parent site (site A), I have a site (site X) which contains a custom list. Site X also contains a data view on a page (Meeting Workspace tab page) which displays the contents of the custom list. This data view can filter the columns through the column headers no problem. Under the same parent site (site A) I have another site (site Y) which contains another site (site Z). Site Z has a page (Meeting Workspace tab page) which has a data view displaying data from the custom list of site X. This data view cannot filter as the drop down menu from the column headers states "This column type cannot be filtered". Are there any solutions or workarounds to get site Z's data view filtering the same way that site X's data view filters?

  • Anonymous
    November 05, 2009
    Hi - can you comment on this error: This page allows a limit of 200 controls, and that limit has been exceeded. I understand there is a setting in the web.config, however I can't understand how a web part page with a single DataFormWebPart can be over the limit of 200 controls on the page. I have a datasource merge of about 20 lists, with 15 columns of information on each. Does each field count as a control?  Thanks in advance.

  • Anonymous
    December 03, 2009
    Hi, we are experiencing a memory leak when we use the WebUrl parameter in the data view / data form web parts. Any ideas or has someone got any workarounds or knows of any hotfixes? I have blogged about this here for those that are interested in reproducing it: http://blogs.livepoint.com.au/Lists/Posts/Post.aspx?ID=30

  • Anonymous
    December 09, 2009
    Any know how to fix PJC issue where the correct number of results come back but on the data? Do you need special SelectParameters or ParameterBindings?

  • Anonymous
    February 01, 2010
    Not sure if anyone has solution for David issue (May 6, 2008 9:41 AM) or not but this is the solution for sorting and filtering issue in DFWP if used with SPSqlDataSource (or SqlDataSource) http://vle4.wordpress.com/2010/02/02/sorting-and-filtering-problem-in-dataformwebpart-if-used-with-sqldatasource/ HTH

  • Anonymous
    February 09, 2010
    Hi, I have a requirement where I have one main site and 5 sub sites. Each sub site has a document library named Projects and within each Document library I have a folder structure automatically created upon creating a folder of content type Project_Folder. The structure is as follows Project Folder 1  Sub Folder1      Sub Folder 11      Sub Folder 12      Sub Folder 13      Sub Folder 14 Sub Folder2      Sub Folder 11      Sub Folder 12      Sub Folder 13      Sub Folder 14 Project Folder 2  Sub Folder1      Sub Folder 11      Sub Folder 12      Sub Folder 13      Sub Folder 14 Sub Folder2      Sub Folder 11      Sub Folder 12      Sub Folder 13      Sub Folder 14 Also each document library in each sub site has a specific content type. Now I want to display documents found in folders with the name Sub Folder 11 only from all sub sites. Is that possible with the Designer DataView

  • Anonymous
    March 04, 2010
    Hi Poonam, You may try to filter the documents by checking whether the document url contains "Sub Folder 11" cross sites. You may figure out the CAML in CamlBuilder first. Hopefully helps, Guangming

  • Anonymous
    April 29, 2010
    Can you use crosslist mode with a "joined" data source? When I attempt this I get "the server retured a non-specific error when trying to get data from the data source." Thanks! Kevin

  • Anonymous
    May 07, 2010
    Group by person. (Please note I'm a rookie) I built my first Data View in MOSS 07 and sort my data by employee name. The counts work great in the footer however the sub counts per employee return 0. I see others that have had similar results but do not see how to resolve. Something about the way SharePoint looks at names... Does anyone have a sample?

  • Anonymous
    July 20, 2010
    Hello There, This is really helpful blog...I have a question here. here is the Requirenmetn which i got today from my client.

  1. we have one Doc Library call Documetns with column name ..rcode,dcode,dpcode,rpcode.
  2. we have one page  call alldocs.aspx where we have a DVWP which link to the Doc Libray(With Filter).
  3. I have 4 pages with same webpart (Link webpart) and when user click on any of the link they'll redirect to AllDoc.aspx.(e.g On Page1--  AllDocs.aspx?rcode="a" and on Page2 -- AllDocs.aspx?dcode="b"                                         Page3 -- AllDocs.aspx?rcode="a" & rpcode = "c"   Page 4 -- AllDocs.aspx?dcode="" & dpcode = "" Can any tell me how can i imlement this requirenment using DVWP. How can filter the DVWP to match the above Req. Thanks DVWP
  • Anonymous
    July 20, 2010
    Hello There, This is really helpful blog...I have a question here. here is the Requirenmetn which i got today from my client.
  1. we have one Doc Library call Documetns with column name ..rcode,dcode,dpcode,rpcode.
  2. we have one page  call alldocs.aspx where we have a DVWP which link to the Doc Libray(With Filter).
  3. I have 4 pages with same webpart (Link webpart) and when user click on any of the link they'll redirect to AllDoc.aspx.(e.g On Page1--  AllDocs.aspx?rcode="a" and on Page2 -- AllDocs.aspx?dcode="b"                                         Page3 -- AllDocs.aspx?rcode="a" & rpcode = "c"   Page 4 -- AllDocs.aspx?dcode="" & dpcode = "" Can any tell me how can i imlement this requirenment using DVWP. How can filter the DVWP to match the above Req. Thanks DVWP