SharePoint 2013 Extension Tilesviewwebpart

Source: Internet
Author: User

SharePoint 2013 adds a new, more useful Web Part, which is tilesviewwebpart.

After you create a new team site, you can see it on the home page:


It can also propose a new promoted Link list as a data source


But what if you want to use a custom data source?

The answer is to inherit the Tilesviewwebpart class and override the Gettiles method:

Using system;using system.componentmodel;using system.web;using system.web.ui;using system.web.ui.webcontrols;using System.web.ui.webcontrols.webparts;using microsoft.sharepoint;using microsoft.sharepoint.webcontrols;using Microsoft.sharepoint.webpartpages;using microsoft.sharepoint.utilities;using System.Collections.Generic;    namespace tilesview.mytileswebpart{[ToolboxItemAttribute (false)] public class Mytileswebpart:tilesviewwebpart        {Private ReadOnly string layoutspath = "/" + Sputility.contextlayoutsfolder + "/tilesview/";        Private readonly string tilestitle = "My first Custom Tileswebpart"; Public Mytileswebpart () {Baseviewid = ((int) tilesbaseviewid.tileview).        ToString (); } protected override tiledata[] Gettiles () {list<tiledata> mytiles = new list<tiledata&            gt; (); Mytiles.add (new Tiledata {Title = "Google Search", Description = "Google SearCH is the search service provided by Google, Launchbehavior = Tilelaunchbehavior.dialog, Li Nklocation = "http://www.google.com", ID = ten, backgroundimagelocation = Layoutspath + "Goog            Le.jpg ", TileOrder = 0});  Mytiles.add (new Tiledata {Title = "Baidu search", Description = "Baidu Search is The best Chinese Search ", Launchbehavior = tilelaunchbehavior.dialog, linklocation =" http:                Www.baidu.com ", ID = $, backgroundimagelocation = Layoutspath +" Baidu.jpg ",            TileOrder = 1});  Mytiles.add (new Tiledata {Title = "bing search", Description = "Bing search is a Search service which provided by Microsoft ", Launchbehavior = Tilelaunchbehavior.dialog, Li    Nklocation = "Http://www.bing.com",            ID = $, backgroundimagelocation = Layoutspath + "Bing.jpg", TileOrder = 2,            });        return Mytiles.toarray ();        } protected override string Viewtitle {get {return tilestitle;} }          }}

The results of the extension are as follows:


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.