Developing Web Parts Using ASP'Net Web UserControls - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Developing Web Parts Using ASP'Net Web UserControls

Description:

Developing Web Parts Using. ASP.Net Web UserControls. By Brett Lonsdale. Combined Knowledge ... Lets Create a simple Exchange Rate WebPart without using a UserControl. ... – PowerPoint PPT presentation

Number of Views:309
Avg rating:3.0/5.0
Slides: 15
Provided by: Instr179
Category:

less

Transcript and Presenter's Notes

Title: Developing Web Parts Using ASP'Net Web UserControls


1
Developing Web Parts UsingASP.Net Web
UserControls
  • By Brett Lonsdale
  • Combined Knowledge

2
Agenda
  • Creating WebParts Without UserControls
  • Overview of creating WebParts
  • Overriding the CreateChildControls method
  • Creating WebParts using UserControls
  • Creating a Virtual Directory
  • Defining Managed Paths
  • Creating a Visual Studio.Net Web Application for
    our UserControl
  • Create the UserControl WebPart
  • Overriding the CreateChildControls method
  • Deploying the WebPart
  • Testing the WebPart

3
Overview of Creating WebParts
  • Install the .net WebPart Templates
  • Rename the WebPart
  • Strongly Name the Assembly
  • Override CreateChildControls Sub (Optional)
  • RenderWebPart
  • Compile/Deploy
  • Test Debug

4
Overview of Creating WebParts Contd
  • Lets Create a simple Exchange Rate WebPart
    without using a UserControl.

5
Overriding the CreateChildControls Method
  • Use Tables to position controls
  • Declare Controls
  • Instantiate Controls
  • Set Properties
  • Add Controls to Controls Collection

6
Create WebParts using UserControlsCreating a
Virtual Directory
  • Create a new Virtual Directory using IIS to house
    a Visual Studio.Net Web Application
  • Creating the Web Application will fail.
  • We will solve this by creating an excluded path.

7
Defining Managed Paths
  • Exclude the Path by using Virtual Server Settings
    in the SharePoint Central Administration Settings.

8
Creating a Visual Studio.Net Web Application for
our UserControl
  • You can now create your web application, but
    still expect an error that needs handling.
  • Call your web application http//PortalName/Userco
    ntrols
  • Handle The Error.

9
Creating a Visual Studio.Net Web Application for
our UserControlContd.
  • Remove Global.asax and web.config
  • Add a Web UserControl
  • Drag and Drop your standard controls
  • Write your code!
  • Test your control using WebForm1.aspx
  • Debug

10
Create the UserControl WebPart
  • Add a WebPart Project to the Solution
  • Rename, Strong name the assembly, Override the
    CreateChildControls method
  • Render the Controls output

11
Deploying the WebPart
  • Create a Cab Project
  • Add the Project Output The Content Files from
    the WebPart project.
  • Deploy the WebPart using STSADM
  • Copy the UserControls DLL to the GAC or the Bin
    directory of the Virtual Server.

12
Testing the WebPart
  • Test the WebPart by dragging and dropping it from
    the Virtual Server Gallery!

13
Future WebParts
  • Re-Use the UserControls Web Application to create
    New webparts in the future.
  • I suppose you could consider the SmartPart???

14
Questions Answers
  • Download these slides from www.combined-knowledge.
    com
  • or from www.suguk.org
Write a Comment
User Comments (0)
About PowerShow.com