DotNetCurry Logo

SharePoint – How to use the Inbuilt Data View Webpart to Display and Perform CRUD Operations on a List

Posted by: Ravi Keshwani , on 9/22/2010, in Category SharePoint
Views: 37321
Abstract: In this article, we will explore how we can use the very useful Data View web part to customize list data and perform CRUD operations on it.
In this article, we will explore how we can use the very useful Data View web part to customize list data and perform CRUD operations on it.
 
Taking a real life example, we will show the name of the teams in a Grid like format (in a list), where members of a team are added. So create 2 lists named ‘Team’ where name of the teams are added and second ‘Members’ where team will be a lookup column.
If you are not aware of how to create lists in SharePoint, please follow this article SharePoint - Creating a Lookup column in a Custom List .
So assuming you have created these 2 lists, let us move ahead to implement our requirement. Follow these steps:
Step 1: Open your site in SharePoint designer.
Step 2: From the ‘Folder list’ to the left, drilldown the ‘Lists’ folder and open ‘Members’ list. The screen would be as shown below. Double click on AllItems.aspx
image_3
Step 3: Now click on split view in the form designer and find the string ‘PlaceHolderMain’. Place the cursor in the next line.
image_1
Step 4: Now click on Insert > Sharepoint Controls > Data View
Step 5: This will add a Webpart, which will show some guidelines of what to do next with it, as shown below
image_2
Step 6: Clicking on the link ‘Click a data source in the…’ will open a Data Source library which will have SharePoint lists. Click on the list named ‘Teams’ and right click on it and then click ‘Show Data’, as shown below.
image_4
Step 7: Clicking on ‘Show Data’ will display the columns belonging to this list. Press the ‘Ctrl’ key and select the columns you want to insert into the data view and click on ‘Insert Selected fields as’ button, above the columns list.
image_3
Step 8: Now this will insert fields in the web part. Right click on the web part and click on ‘Show Common Control Tasks’ which will provide options to customize the web part as per our needs. This is similar to customizing the Grid in ASP.NET
Step 9: Click on Data View properties from this properties window and using it, check the checkbox ‘Show toolbar with options for’ in the General tab and check the options of Filter, Sort and Grouping.
Step 10: Also to make CRUD operations active, go to the Editing tab of the popup and click on required operations, as shown below.
image_5
Refresh the page in your SharePoint website, which is currently showing the members list and see the magic. The output will be similar to the one show below.
image_1
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+
Further Reading - Articles You May Like!


Page copy protected against web site content infringement 	by Copyscape




Feedback - Leave us some adulation, criticism and everything in between!
Comment posted by Mike Lauer on Tuesday, October 19, 2010 9:42 AM
Good article, but does this apply to SharePoint 2010, 2007, or both?
Comment posted by Ravi Keshwani on Monday, January 16, 2012 4:27 AM
No this is for SP 2007