.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

SharePoint 2013: Create custom list template set Default view as Datasheet View programmatically

Posted By:Sagar Pardeshi       Posted Date: April 26, 2014    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

SharePoint 2013: Create custom list template set Default view as Datasheet View programmatically


SharePoint provides a lot of ways to show the content of a list. SharePoint Views are one of them to present the data in different manners with different columns, styles, sorting, filtering, and grouping. In SharePoint, views can be of two categories: Public and Private.


Public Views are available to every user who is a site member on the site.

Private View is available for only the user who has created that particular view.


SharePoint by default provides different types of view as Calendar View, Datasheet View, and Gantt View etc.


Datasheet View displays the items in Microsoft Excel format that allows us to copy and paste data from and into the list.

Datasheet views in SharePoint 2010 are great for performing bulk updates on list items and document properties in a library. A Datasheet view is a great way to quickly change the content type of a list item or document


Let's Process Following steps

Create a custom list definition (not a list instance) using the Visual Studio 2012 visual designer with step-by-step with screenshots.

In Visual Studio 2012 select File | New Project

Select Templates | Visual C# | Office/SharePoint | SharePoint 2013 - Empty Project

Once the new solution has been created, we can use the new Visual Designer to create the List Definition. Right click the project in the solution explorer and select Add | New Item

 Select Visual C# Items | Office/SharePoint | List, provide a name and click OK.

Provide a display name for the list. We just want to create a list definition, not an instance of the list; This isn't an option so what we do instead is go with the "Create a customizable list template and a list instance of it"

List instance Select Schema.xml edits View  Base view ID section Add Type ="Grid"  like below format for Datasheet view

- <View BaseViewID="1" Type="Grid" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/generic.png?rev=23" Url="AllItems.aspx">
  <Toolbar Type="Standard" /> 
  <XslLink Default="TRUE">main.xsl</XslLink> 
  <RowLimit Paged="TRUE">30</RowLimit> 
- <ViewFields>
  <FieldRef Name="LinkTitle" /> 
- <Query>
- <OrderBy>
  <FieldRef Name="ID" /> 
- <ParameterBindings>
  <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /> 
  <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /> 

Save and  deploy solution in extented webapplication ,then

Go->Site Content  Create New list user our own create Templete  for  Custom List in Datasheet view (CustomDataSheetListTemplate)



In this article we explored a practical scenario of creation with List Instance Datasheet view. The source code is associated with this article.

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend