SharePoint 2013 Graphic Development series of WebPart

Source: Internet
Author: User

Text: SharePoint 2013 graphic Development series of WebPart

This is our first introduction to Getting Started with SharePoint development, where we'll cover several key physical paths to SharePoint development, some development tips and the most basic webpart development.

Development tools

In SharePoint 2013 development, we were using Visual Studio 2012/2013, but VS2012 to install additional Microsoft Office Develop Tools for Visual Studio 2012, you can use Microsoft Web PlatForm install for installation.

Several key positions

In SharePoint development, not only WebPart, we are often using several key locations, as follows:

Gac:

C:\Windows\assembly, i.e. the location of the deployment;

ISAPI location, SharePoint API:

C:\Program Files\Common files\microsoft Shared\Web Server Extensions\15\isapi;

ControlTemplates location, SharePoint controls/templates:

C:\Program Files\Common files\microsoft Shared\Web Server Extensions\15\template\controltemplates;

XML location, SharePoint descriptive file location:

C:\Program Files\Common files\microsoft Shared\Web Server Extensions\15\template\xml;

Layouts location, SharePoint Publishing page:

C:\Program Files\Common files\microsoft Shared\Web Server Extensions\15\template\layouts;

Feature location, SharePoint Feature Deployment location:

C:\Program Files\Common files\microsoft Shared\Web Server Extensions\15\template\features;

Images location, SharePoint Picture library:

C:\Program Files\Common files\microsoft Shared\Web Server Extensions\15\template\images;

Logs location, SharePoint log files:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\logs

WebPart Introduction

WebPart, as the name implies, is the meaning of Web Parts, simple understanding is to implement a certain part of the page; SharePoint WebPart, is to deploy the application set to the GAC or the bin directory, To add a strong name in Web. config (SharePoint does not recognize a WebPart that does not strengthen the name), let's briefly describe how to create a WebPart.

WebPart Create a process

1, create the project, the project type is SharePoint2013 empty project, such as:

2, choose the solution type, here Select the farm solution, such as:

3. Add a new item to the project and select the Web Part, such as:

4. After adding a new item, the project looks like this:

For example, the right-hand directory includes: A feature file, a WebPart file, a strong name, and a left-hand side, a create control method, and an output method.

5, modify the feature file, such as:

6. Modify the WebPart properties (title and description), such as:

7. Add code for the appropriate method, and then deploy, such as:

8. Add webpart on the page, such as:

9, after adding, save the page, such as:

10, click the button test, such as:

For example, after clicking the test to execute the event, the text of the label is modified to indicate that the program executed successfully. Of course, this is just a test of a WebPart demo, you can write simple picture carousel parts, copy the logical processing parts, there is no problem, just enrich the method.

In addition to testing demo , there are a few points to note:

The project file Customwebpart.webpart deployed in the site settings, Web Parts gallery, such as:

WebPart Properties Panel Configuration

Of course, we can also add the right side of the property panel for WebPart, for future configuration of WebPart, we just need to declare the variables in the CustomWebPart.cs file:

Private stringURL ="Http://www.cnblogs.com/jianyus"; [WebBrowsable (true)][webdisplayname ("URL")][webdescription ("This is Site Url ...")][category ("Set")][personalizable (true)] Public stringmyurl{Get    {        returnURL; }    Set{URL=value; }}

Statements such as:

Effects such as:

Of course, I test here is a single line of text, you can try the enumeration type (drop-down option), Boolean type (option), as long as the above declaration can be.

If you need a very complex property panel, or need to have a linkage of the panel, then you can refer to EditorPart or Toolspart, not in-depth introduction here, my blog has relevant content of the blog, Welcome to reference.

Finally, the next WebPart deployment process, the DLL file is deployed to the GAC or the bin directory, if you need to add a configuration file, you can add to the associated application (port) Web. config, and then read in a WebPart in. NET mode.

As this article is the development of entry-level blog, please God do not spray, if there is a comment, welcome to the blog after the discussion of the message, especially said: Thank you!

Total Knot

Above, basically is the basic knowledge of WebPart development, now, you can refer to above, develop a simple WebPart practice practiced hand, remember, do not write code, to learn to think and understand.

SharePoint 2013 Graphic Development series of WebPart

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.