Parallelminds.web partdemo1


Published on


Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Parallelminds.web partdemo1

  1. 1. Manisha M. Chothe<br />Junior Solution Developer <br />Parallel Minds Technology Solutions Pvt. Ltd. <br /><br />(o) + 91-20-65000209 <br /><br />Google:<br />
  2. 2. Agenda<br />1 Introduction<br />2.     Before webpart<br />3.     Need of webpart<br />4.     Web part benefits<br />5.     Dev environment required for web parts<br />6.     Web part infrastructure<br />7.     Hello world web part<br />8.     Getting property from editor zone<br />9.     Calling web service from web part<br />10.     Showcase Data grid in web part<br />11.   Using ajax in webpart<br />12.   Using user control in web part<br />13.   Best coding practices for web part<br />
  3. 3. Web Parts in<br />
  4. 4. What is Web Part???<br />
  5. 5. Introduction<br />A Web Part is a .NET Web custom control assembly that uses a Web Part description file (.dwp). <br />The .dwp file contains XML metadata that describes an instance of the Web Part.<br />Web Parts is a framework built into ASP.NET 2.0 for building highly customizable portal-style pages. <br />
  6. 6. Introduction<br />ASP.NET Web parts is an integrated set of controls for creating Web sites that enable end users to modify the content, appearance, and behavior of Web pages directly from a browser.<br />End users can customize Web Parts pages by changing the page layout, adding and removing Web Parts, editing Web Parts properties, establishing connections between Web Parts, and more. <br />
  7. 7. Before Web Parts…..<br />Before ASP.NET 2.0, developer had to build his own custom personalization framework to implement personalization feature in the application.<br />Web Parts are included in ASP.NET server control framework and are used like any other ASP.NET server controls. <br />
  8. 8. Building Web Parts<br />There are two basic ways to create a Web Part.<br /> You can treat any standard Microsoft ASP.NET control as a Web Part or <br />you can build a custom control that derives from the base WebPart class.You are not required to modify a control in any way to use it as a Web Part. Standard ASP.NET controls (such as the Calendar and GridView controls), Web User Controls, and even custom controls can all be used as Web Parts. <br />
  9. 9. Web Parts ControlsThe Toolbox area within Visual Studio (when developing Web Forms) includes a Web Parts category that contains the various controls available to utilize Web Parts in an application.<br />
  10. 10. ASP.NET 2.0 Web Part page<br />
  11. 11. ASP.NET Web Parts Life Cycle<br />
  12. 12. ASP.NET Web Parts Life Cycle<br />Initialization:-The WebPartZone objects register with the WebPartManager control.The WebPartManager control loads the static WebPart objects.The WebPartManager control calls the TrackViewState method for each static WebPart object already in the control hierarchy at this point.<br />Initialization Complete:-The WebPartManager control loads the dynamic WebPart objects and the WebPartConnection objects. <br /> The WebPartManager control calls the WebPartPersonalization control on the static and dynamic WebPart objects.<br />
  13. 13. ASP.NET Web Parts Life Cycle<br />Load Complete:-The WebPartManager control activates the WebPartConnection objects.<br />Save State Complete:-<br /> The WebPartManager control saves the static and dynamic WebPart objects' personalization information in permanent storage.<br />
  14. 14. ASP.NET 2.0 Web Part infrastructure<br />
  15. 15. Advantages of Web Parts<br />Web Parts allows for personalization of page content. They allows users to move or hide the Web Parts and add new Web Parts changing the page layout.<br />Web Parts allows user to export or import Web Parts settings for use in other pages. Web Parts retain the properties, appearance and the data across the pages when imported or exported.<br />Web Parts can be assigned role-based access. So you can determine which Web Parts can share by all or which should be hidden for certain roles. This helps us to provide customized content based on security.<br />Web Parts can talk to each other. You can utilize the data in one Web Part in another Web Part for different purposes.<br />
  16. 16. Web Parts Modes<br />a) Normal mode: End user cannot edit or move sections of page.<br />b) Edit Mode: End user can edit Web Parts on the page including Web Parts title, color or even setting custom properties.<br />c) Design Mode: End user can rearrange the order of the pages Web Parts in a WebPartZone.<br />d) Catalog Mode: End user enjoys the choice to add new Web Parts or add deleted Web Parts in any WebPartZone on the page.<br />
  17. 17. ASP.NET Web Parts Controls<br />WebPartManager:-<br /> The WebPartManager is the manager for all web parts. If you use webparts in your web projects you are required to use the WebPartManager. Usually you just drag and drop this into your webform and are ready to go.<br />WebPart Zones:-<br /> There are four kinds of zones in web part zones:<br />Web Part Zone<br />Editor Zone<br />Catalog Zone<br />Connection Zone<br />WebPart Zone:-<br />The web part Zone is the basic unit for web parts. By placing different contents in a web part zone we can allow a user to drag and drop contents on a page.<br />
  18. 18. WebParts ZoneCatalog Zone<br />The purpose of the CatalogZone control is to allow end users to customize Web Parts pages by adding Web Parts to them. <br />for example, to enable users to restore closed Web Parts to the page by including a CatalogZone in the page.<br />A Catalog Zone can contain several types of Catalog Part controls. The following list summarizes the Catalog Part controls provided with the Web Parts control set:<br />PageCatalogPart<br />DeclarativeCatalogPart<br />ImportCatalogPart<br />
  19. 19. WebParts Zones EditorZone<br /> The EditorZone Web Server control serves as the primary control in the Web Parts control set for hosting EditorPart controls on a Web page.<br />AppearanceEditorPart:-<br /> Lets users customize the visual properties of a WebPart control at run time, such as the width,height, and title.<br />BehaviorEditorPart:-<br /> Lets users customize behavior properties of a WebPart control at run time, such as displaying minimize, close, and edit buttons.<br />LayoutEditorPart:-<br /> Lets users customize layout properties of a WebPart control at run time, such as selecting a minimized or normal state, or setting the index at which the control will appear within the target zone.<br />PropertyGridEditorPart:-<br /> Lets users edit custom properties at run time that are declared as part of a WebPart control.<br />
  20. 20. WebParts Zones ConnectionZone<br /> The ConnectionsZone Web server control provides a user interface (UI) that enables users to form connections between WebPart and other server controls that reside in WebPartZoneBasezones.<br /> You can connect controls in these ways:<br />Declare a connection in a Web page.<br />Create a connection in code.<br />Add a ConnectionsZone control to the page so that users can connect the controls on demand.<br />
  21. 21. WebParts in Following is the list of features provided exclusively by the SharePoint WebPart class:<br />Cross page connections<br />Connections between Web Parts that are outside of a Web Part zone<br />Client-side connections (Web Part Page Services Component)<br />A data caching infrastructure that allows caching to the content database<br />
  22. 22. Simple Hello World Example for Web Parts<br />
  23. 23. Hello World Example for Web PartsVisual studio ->create web Site -> web site ->ok<br />
  24. 24. Hello World Example for Web PartsOutput Screen<br />
  25. 25. Hello World Example for Web PartsOutput Screen<br />
  26. 26. Example of Web Parts<br />
  27. 27. Use of User Control in Web Part<br />
  28. 28. Use of User Control in Web PartSol. Exp -> Add ->New item -> select web user control -> Add<br />
  29. 29. Use of User Control in Web PartDesign view of user control <br />
  30. 30. Use of User Control in Web PartDesign view of web part containing user control <br />
  31. 31. Use of User Control in Web PartOutput Screen of web part with user control<br />
  32. 32. Use of User Control in Web PartOutput Screen of web part with user control<br />
  33. 33. User Control Vs Web Parts<br />User Control<br />User Controls cannot be shared across web applications but they can be created using a designer tool.<br />Customization and personalization is not possible using User Controls.<br /> Web Part<br />Web Part is a combination of User Control and Custom Control.<br />Web Parts are ASP.NET controls in that they add extra dimensions of user customization and personalization.<br />
  34. 34. Getting Property From Editor Zone<br />
  35. 35. Getting Property From Editor Zone<br />
  36. 36. Getting Property From Editor Zone<br />
  37. 37. Getting Property From Editor Zone<br />
  38. 38. Getting Property From Editor Zone<br />
  39. 39. Getting Property From Editor Zone<br />
  40. 40. Getting Property From Editor Zone<br />
  41. 41. Getting Property From Editor Zone<br />
  42. 42. Getting Property From Editor Zone<br />The code will populate the DropDownList with all the available modes for the WebParts. <br /> private void BindData()<br /> {<br />WebPartDisplayModeCollection modes = wpm.DisplayModes;<br />foreach (WebPartDisplayMode mode in modes)<br /> {<br />ddlModes.Items.Add(mode.Name); <br /> }<br />ddlModes.DataBind(); <br /> }<br />
  43. 43. Getting Property From Editor Zone<br />Now, in order to select the particular mode you need to catch the Selected_IndexChanged event of the DropDownList. <br />protected void ddlModes_SelectedIndexChanged(object sender, EventArgs e)<br />{<br />WebPartDisplayMode mode = (WebPartDisplayMode) wpm.SupportedDisplayModes[ddlModes.SelectedValue];<br />wpm.DisplayMode = mode; <br />}<br />
  44. 44. Web Services in<br />
  45. 45. Step 1: Create the ASP.NET Web Service Source File<br />Web Services in<br />File: MyWebService.asmx<br /><%@ WebService Language="C#" class="MyClass" %><br /> using System.Web.Services ; <br /> public class MyClass<br /> { <br /> [WebMethod()] <br /> public int Add ( int a, int b) <br /> {<br /> return a + b ; <br /> } <br /> }<br />
  46. 46. Calling Web Service From Web Parts<br />
  47. 47. Calling Web Service From Web PartsCreate web site-> web service-> ok<br />
  48. 48. Calling Web Service From Web Parts<br />
  49. 49. Calling Web Service From Web Parts<br />
  50. 50. Calling Web Service From Web Parts<br />
  51. 51. Calling Web Service From Web Parts<br />
  52. 52. Calling Web Service From Web Parts<br />
  53. 53. AJAX in<br />
  54. 54. AJAX in<br />Ajax enables you to build highly interactive and responsive web applications by doing more in the browser.<br />provides a framework for asynchronously dispatching and processing requests and responses from the server.<br />The ASP.NET Ajax Library enables you to enhance ASP.NET Web Forms applications with Ajax. You don't need to know JavaScript to use the controls in the ASP.NET Ajax Library.<br />The ASP.NET Ajax Library includes the Ajax Control Toolkit. The Ajax Library contains more than 30 controls that enable you to easily create rich, interactive web pages. <br />For example, you can use the Ajax Library controls to display HTML editors, auto-complete textboxes, cascading dropdown lists, picture slide shows, and modal popup dialog boxes.<br />
  55. 55. Ajax Server Controls<br />The topics in this section describe how to work with ASP.NET Web server controls that enable you to add Ajax functionality to an ASP.NET Web page.<br />ScriptManager Control OverviewManages client script for Ajax-enabled ASP.NET pages. By default, the ScriptManager control registers the script for the Microsoft Ajax Library with the page. This enables client script to use the Microsoft Ajax type system extensions and to support features such as partial-page rendering and Web-service calls. In addition, theScriptManager control enables the Microsoft Ajax Library to be loaded from the Microsoft Content Delivery Network (CDN).<br />Timer Control OverviewPerforms tasks at defined intervals. If you use the Timer control with an UpdatePanel control, you can enable partial-page updates at a defined interval. You can also use the Timer control to perform full-page postbacks.<br />
  56. 56. Ajax Server Controls<br />UpdatePanel Control OverviewEnables you to refresh selected parts of the page instead of refreshing the whole page with a postback. An ASP.NET Web page that contains a ScriptManager control and one or more UpdatePanel controls can automatically participate in partial-page updates, without custom client script.<br />UpdateProgress Control OverviewEnables you to provide status information about partial-page updates in UpdatePanel controls.<br />
  57. 57. Use of Ajax in web Parts<br />
  58. 58. Use of Ajax in web Parts<br />
  59. 59. Use of Ajax in web Parts<br />
  60. 60. Use of Ajax in web Parts<br />
  61. 61. Use of Ajax in web Parts<br />
  62. 62. Use of Ajax in web Parts<br />
  63. 63. Use of Ajax in web Parts<br />
  64. 64. AJAX in SharePoint 2010<br />SharePoint Ajax Library for SharePoint 2010, release 1.1.<br />SharePoint Ajax Library 2010 1.1 <br />This is a base framework built on top of the Microsoft AJAX Library and ASP.NET AJAX for deploying client-side AJAX Web Parts and controls that work against web services and Xml feeds utilizing the ASP.NET AJAX framework. <br />
  65. 65. Showcase of Gridview in Web Part<br />
  66. 66. Showcase of Gridview in Web Part<br />
  67. 67. Showcase of Gridview in Web Part<br />
  68. 68. WebParts Zones Connection Zone<br />
  69. 69. WebParts Zones Connection Zone<br />
  70. 70. Thank You!<br />