Microsoft Office SharePoint Designer 2007 – Designing and by yaoyufang

VIEWS: 35 PAGES: 12

									Hands-on Lab Overview

    1. Introduction

HOL483: Microsoft Office SharePoint Designer 2007 – Designing and Importing User Controls

    2. Technologies Highlighted

                   Microsoft® Windows® SharePoint® Services 3.0
                   Microsoft® Office SharePoint® Designer 2007
                   Microsoft® Visual Studio 2005

    3. Audience

            Developer – 400 level

    4. Scenario

            In this lab you will see how Microsoft® Office SharePoint® Designer 2007 can be used to visually design controls that could be
            extended with Visual Studio code-behinds.

    5. Purpose of Hands-on Lab

            This lab will give the participant an understanding of how to use Microsoft Office SharePoint Designer 2007 to design user controls to
            which can be imported in Visual Studio to have a code-behind added.


Hands-on Lab

Discussion Points                                                           Actions taken

Designing a User Control

This section covers how to create a custom user control and add it to the
page.


                                                                            1
Setup                                                                                    Log in using the following credentials:
                                                                                           Logon: administrator
                                                                                           Password: pass@word1
                                                                                         Wait for the Warmup script to complete and close

Design User Control                                                                      Click Start  All Programs  Microsoft Office  Microsoft Office
                                                                                          SharePoint Designer 2007
Setting the css class of specific elements in the user control will not change           If prompted for authentication click Cancel
the appearance of the control within Office SharePoint Designer 2007. The                If a site is opened by default select the Close Site option in the File menu
css classes that are set in this section are defined in the main SharePoint css          Create a new user control by using File  New…  Page…
file. The user control itself does not reference this file; however, when the            In the New dialog on the Page tab, select ASP .NET in the left box and Web
user control is added to a SharePoint page the css styles will be applied.                User Control in the right box and click OK
                                                                                         Create a table in the control by using Table  Insert Table
                                                                                         In the Insert Table dialog, enter 6 in the Rows textbox, enter 2 in the Columns
                                                                                          textbox and click OK
                                                                                         Set the css class of the table cells by selecting all table cells. Next in the Tag
                                                                                          Properties in panel in the lower left of the application find the class attribute and
                                                                                          set it to ms-vb
                                                                                         Click in the top, left column of the table and type Name:
                                                                                         Set the text in the remaining cells in the left column (top to bottom) as follows:
                                                                                          Account Number:, Address:, Phone Number:, Credit Rating: and Active:
                                                                                         Add Account Name DropDownList to the top, right cell. Locate the
                                                                                          DropDownList control in the Toolbox task pane under ASP .NET
                                                                                          Controls/Standard. Drag the control into the top, right cell of the table
                                                                                         Select the control that was added. In the Tag Properties panel, change the ID
                                                                                          attribute (in the Misc section) to acctNameDdList and the CssClass (sets the
                                                                                          css class on web controls) attribute (in the Appearance section) to ms-vb
                                                                                         Add a Name Label to the second column in the second row of the table. Locate
                                                                                          the Label control in the Toolbox task pane under ASP .NET
                                                                                          Controls/Standard. Drag the control into the second column in the second row
                                                                                          of the table
                                                                                         Select the control that was added. In the Tag Properties panel, change the ID
                                                                                          attribute (in the Misc section) to acctNumLbl and delete the value of the Text
                                                                                          attribute
                                                                                         Add a Label control to rest of empty right table cells by dragging a Label control
                                                                                          from ASP .NET Controls/Standard in the Toolbox task pane. For each label
                                                                                          control delete the value of the Text attribute and set the ID attribute of the
                                                                                          controls from top to bottom as follows: addrLbl, phoneLbl, creditLbl, and
                                                                                          activeLbl
                                                                                         Save file by selecting File  Save As…
                                                                                         In the Save As dialog, type VendorAccount.ascx in the File name textbox and
                                                                                          click Save
                                                                                         Export file to local machine by using File  Export  File
                                                                                         In the Export File As dialog, navigate to C:\HOL and click Save
                                                                                  2
                                                                                      Click OK in the popup
                                                                                      Close Office SharePoint Designer 2007

Create Code Behind Project                                                            Start Visual Studio 2005 by using Start  All Programs  Microsoft Visual
                                                                                       Studio 2005  Microsoft Visual Studio 2005
This section pulls together the previous sections and shows how all of the            Create a new project by using File  New  Project…
customizations created in the custom site definition are automatically enabled        In the New Project dialog
and working in the deployed solution.                                                        In Project types select Visual C#
                                                                                             In Templates select Class Library
                                                                                             In the Name textbox type AdventureWorks
                                                                                             Click the Browse button, in the Project Location dialog navigate to
                                                                                                C:\HOL and click Open
                                                                                             Uncheck Create directory for solution
                                                                                             Click OK button
                                                                                      Add a reference to System.Web
                                                                                             Open the Solution Explorer by selecting View  Solution Explorer
                                                                                             Right click on References and select Add Reference…
                                                                                             On the .NET tab, scroll down the list of assemblies, select System.Web
                                                                                                and click OK
                                                                                      Set the output path of the solution
                                                                                             In the Solution Explorer double click Properties
                                                                                             On the left click on the Build tab
                                                                                             Delete the text in the Output path textbox and type bin\
                                                                                      Sign the assembly
                                                                                             On the left click on the Signing tab
                                                                                             Check the Sign the assembly checkbox
                                                                                             In the Choose a strong name key file, drop-down select <New…>
                                                                                             In the Create Strong Named Key dialog, type AdventureWorks in the
                                                                                                Key File Name textbox, uncheck the Protect my key file with a
                                                                                                password checkbox and click OK
                                                                                      In the Solution Explorer, right click on Class1.cs and select Delete

Create VendorAccount Code Behind                                                      Add a new class by right clicking AdventureWorks in the Solution Explorer and
                                                                                       select Add  Class…
In this section, the class file VendorAccount.cs will be created. The class that      In the Add New Item dialog, in the Categories box select Visual C# Project
it will define is the code behind for the user control (VendorAccount.ascx) that       Items, in the Templates box select Class, type VendorAccount.cs in the File
was created earlier.                                                                   name text and click Add
                                                                                      Delete all of the content from the file by hitting Crtl + A to select all of the text in
After adding the class, the basic framework or skeleton of the class will be           the file and then hit the Delete button
added to the file. The using statements at the beginning of the file imports          Insert the snippet SPD  AdventureWorks  VendorAccount Skeleton
namespaces, so that classes can be used within the file without fully qualified              To insert a snippet, right click the target location of the snippet with the
names.                                                                                           file then select Insert Snippet… A list will then appear with all of the
                                                                                                 categories of snippets available for this type of file (in this case C#).

                                                                                   3
After the using statements the line namespace AdventureWorks declares                       Select the desired category by double clicking it (in this case
the namespace of the class.                                                                 AdventureWorks). Another list appears with all of the available
                                                                                            snippets within the category. Double click the desired snippet
On the next significant line the portion public class VendorAccount                         (VendorAccount Skeleton) to insert the snippet.
declares the class name and that the class is public and can be used
anywhere. The second half of the line : UserControl states that the
VendorAccount class inherits from the UserControl class which is the
base class for all user controls.


Add VendorAccount Global Variables and Constructor                                  Highlight the following line in the file
                                                                                      // replace with VendorAccount Variables and Constructor
In this section, the global variables and constructor of VendorAccount will be           snippet
added to VendorAccount.cs.                                                          Right click the highlighted text and hit the Delete key
                                                                                    Where the deleted text was, insert the code snippet SPD  AdventureWorks
public const string DB_CONNECTION_STR = "Data                                         VendorAccount Variables and Constructor
Source=moss;User ID=sa;Password=pass@word1;Initial
Catalog=AdventureWorks;";

This line declares the variable DB_CONNECTION_STR which is used as the
database connection for the queries within the class. For more information
about of database connection strings consult this web site:
http://msdn2.microsoft.com/en-
us/library/system.data.sqlclient.sqlconnection.connectionstring(VS.71).aspx

public const string VENDOR_ID_QUERY_STR = “VID”;

The query string that passes the currently selected vendor name. This will be
explained further later in the script.

private int currentVendorId = -1;

ID of the currently selected vendor in the acctNameDdList drop down list.

The rest of the protected variables declared are the controls added earlier to
the user control in Office SharePoint Designer 2007. They must be declared
in VendorAccount in order to be able to modify their attributes dynamically.

public VendorAccount() {}

This is the constructor of the class. Nothing is actually performed in the


                                                                                 4
constructor of VendorAccount.

Add VendorAccount OnInit Method                                                         Highlight the following line in the file
                                                                                          // replace with VendorAccount OnInit snippet
During this section, the OnInit method will be added to VendorAccount.                  Right click the highlighted text and hit the Delete key
                                                                                        Where the deleted text was, insert the code snippet AdventureWorks 
The OnInit method added by the snippet will override the OnInit method of                VendorAccount OnInit
the parent class of VendorAccount, UserControl. The OnInit method is called
during the Init event of the control’s lifecycle. At this time the basic dynamic
settings of control are initialized.

base.OnInit(e);

This calls the OnInit method of UserControl (the parent class of
VendorAccount). The override modifier in the method declaration specifies
that all calls to OnInit will call VendorAccount’s OnInit method instead of
UserControl’s. Since we override the OnInit method of UserControl must be
explicitly called UserControl so that any underlying initialization code will be
run.

acctNameDdList.SelectedIndexChanged += new
EventHandler(acctNameDdList_SelectedIndexChanged);

This adds an EventHandler to the acctNameDdList drop down. When the
drop down’s index is changed, the method
acctNameDdList_SelectedIndexChanged is called.

The rest of the method sets the currentVendorId variable. The
currentVendorId is the ID of vendor to be displayed in table. This means that
the name of the vendor will be the selected name in the drop down list and
the vendor’s information will be used to populate the rest of the table. The
currentVendorId is initialized to -1 at the beginning of the class. If the request
is a GET request and the VID query string variable is passed, the code will
attempt to parse the VID query string. If an exception is thrown while trying
to parse the value of the VID query string, nothing will be done and
currentVendorId will remain set to -1.

Add VendorAccount OnLoad Method                                                         Highlight the following line in the file
                                                                                          // replace with VendorAccount OnLoad snippet
In this section, the OnLoad method will be added to the VendorAccount                   Right click the highlighted text and hit the Delete key
class.                                                                                  Where the deleted text was, insert the code snippet AdventureWorks 
                                                                                         VendorAccount OnLoad
The OnLoad method added by the snippet will override the OnLoad method
                                                                                     5
of the parent class of VendorAccount, UserControl. The OnLoad method is
called during the Load event of the control’s lifecycle. At this time the
control’s view state has been set and its child controls have been created.

base.OnLoad(e);

This calls the OnLoad method of UserControl (the parent class of
VendorAccount). The override modifier in the method declaration specifies
that all calls to OnLoad will call VendorAccount’s OnLoad method instead of
UserControl’s. Since we override the OnLoad method of UserControl must
be explicitly called UserControl so that any underlying initialization code will
be run.

if (!this.Page.IsPostBack)

All of the logic in the method is wrapped in the above if statement. The inner
code will only be executed if the request was not a POST request (in other
words a GET request). This check is there because the attributes of the child
controls only need to be set during the Load event if the request is a GET
request. Once the attributes are set on the controls, there set is saved to the
view state of the control and posted back to the server during POST
requests. So it is best (performance wise) not to run the inner code and
make another request to the database.

acctNameDdList.AutoPostBack = true;

Specifies that when the index of the drop down list changes automatically
post back the page to the server.

acctNameDdList.DataTextField = "Name";

Specifies the data column of the table that is bound to drop down list to
display as the text for the options of the drop down list.

acctNameDdList.DataValueField = "VendorID";

Specifies the data column of the table that is bound to drop down list to
display as the value for the options of the drop down list. These values are
not actually displayed in the UI but are what is posted back to the server.
This column is used instead of the Name column as each value is unique to
the table whereas the duplicate values in Name column are permitted.



                                                                                   6
acctNameDdList.DataSource = GetVendorNames();

Sets the value returned by GetVendorNames (a DataSet) as the data source
for the drop down list.

acctNameDdList.DataBind();

After a data source is set to a control, it must be bound to the control which
actually populates the control’s values.

if (currentVendorId > -1)

{

        acctNameDdList.SelectedValue =
        currentVendorId.ToString();

}

If currentVendorId has been set to a value greater than -1, the code sets the
select value to the value of currentVendorId.

try

{

        currentVendorId =
        Int32.Parse(acctNameDdList.SelectedValue);

} catch (Exception) { }

Set the selected value to currentVendorId. In case that the currentVendorId
was not set to greater than -1 (and needs to be set to the value of default
selected item) or the selected value was not valid, it needs to be updated.

SetVendorInformationDisplay();

Populates the controls vendor information with information retrieved from the
database.


Add SetVendorInformationDisplay method to VendorAccount                             Highlight the following line in the file
                                                                                      // replace with VendorAccount SetInformationDisplay
In this section, the SetVendorInformationDisplay method will be added to                 snippet
                                                                                 7
VendorAccount.                                                                          Right click the highlighted text and hit the Delete key
                                                                                        Where the deleted text was, insert the code snippet AdventureWorks 
The SetVendorInformationDisplay method sets the properties of the                        VendorAccount SetVendorInfoDisplay
VendorAccount child controls. These where the control defined in
VendorAccount.ascx and at the top of VendorAccount.cs (the protected
variables).

The child controls are populated with the information contained in the
DataSet returned by GetVendorInformation.

DataSet vendorAddrDs = GetVendorInformation();



Sets the DataSet variable vendorAddrDs to the value returned by the
GetVendorInformation method.

if (vendorAddrDs == null)

If the DataSet returned by GetVendorInformation is null, meaning it was an
invalid query, exit the method.

acctNumLbl.Text =
vendorAddrDs.Tables[0].Rows[0]["AccountNumber"].ToString(
);

phoneLbl.Text =
vendorAddrDs.Tables[0].Rows[0]["Phone"].ToString();

Set the Text attributes of acctNumLbl and phoneLbl to the values of their
corresponding columns in the DataSet.

string tempStr =
vendorAddrDs.Tables[0].Rows[0]["ActiveFlag"].ToString();

activeLbl.Text = tempStr == "0" ? "No" : "Yes";

The ActiveFlag column is set to 0 in the database if the vendor is not active
and 1 if it is. Instead of showing 0 and 1, the second line checks if the value
of the column (set to tempStr variable) is equal to “0”. If it is equal to “0” the
activeLbl’s Text attribute is set to "No" otherwise it is set to "Yes".

The vendors are assigned credit rating of 1 through 5 in the CreditRating

                                                                                     8
column (in the database) those numbers correspond to string
representations. Those representation are as follows:

1 - Superior
2 - Excellent
3 - Above Average
4 - Average
5 - Below Average

The value of the CreditRating column (assigned to tempStr variable) is put
into a switch statement and the string representation of the credit rating is set
to the creditLbl’s Text attribute.

The Text attribute of the addrLbl is comprised of the values of 4 columns of
the DataSet and will be in this format on the page.

[AddressLine1]

[City], [StateProvinceCode] [PostalCode]

Add acctNameDdList_SelectedIndexChanged method to                                      Highlight the following line in the file
VendorAccount                                                                            // replace with VendorAccount
                                                                                            acctNameDdList_SelectedIndexChanged snippet
In this section, the acctNameDdList_SelectedIndexChanged method will be                Right click the highlighted text and select Delete
added to VendorAccount.                                                                Where the deleted text was, insert the code snippet AdventureWorks 
                                                                                        VendorAccount acctNameDdList_SelectedIndexChanged
The method acctNameDdList_SelectedIndexChanged was set as the event
receiver of the index changed events of the acctNameDdList drop down list
earlier in the OnInit method.

If the index changes on the control, the label controls must be updated with
the information of the vendor with the ID currently selected in
acctNameDdList, so currentVendorId is set to the selected value of
acctNameDdList and SetVendorInformationDisplay is called to populate the
Label controls with selected vendor’s information.
Add SQL code to VendorAccount                                                          Highlight the following line in the file
                                                                                         // replace with VendorAccount SQL snippet
In this section, the SQL related methods will be added VendorAccount.                  Right click the highlighted text and select Delete
                                                                                       Where the deleted text was, insert the code snippet AdventureWorks 
This code snippet inserts three methods: GetVendorNames,                                VendorAccount SQL
GetVendorInformation, and QueryDatabase.

GetVendorNames defines the query string needed to retrieve all of the
vendor names from the database. It then passes this query string to the
                                                                                    9
QueryDatabase method and passes back its result.

GetVendorInformation defines the query string needed to a vendor’s
information from the database. It then passes this query string to the
QueryDatabase method and passes back its result.

QueryDatabase actually queries the database with the query string passed in
the parameters and returns the result of the query.

Build AdventureWorks Project                                                         Build the project by using Build  Build AdventureWorks

In this section, the AdventureWorks project will be built to generate the
AdventureWorks assembly.
Modify VendorAccount.ascx to Use Code Behind                                         Obtain the public key token of AdventureWorks.dll
                                                                                       On the Desktop double click on Office 12 Command Prompt icon to open
This section cover editing the VendorAccount.ascx created earlier in Office              a command prompt
SharePoint Designer 2007 to use the VendorAccount class that was just                     The Office 12 Command Prompt is like any other command prompt
defined.                                                                                      except it has environment variables loaded for SharePoint and Office
                                                                                              tools
The first step in this section is to determine the public key token of                 Navigate to the bin directory of the AdventureWorks project by typing cd
AdventureWorks.dll. Earlier after creating the AdventureWorks project, the               \HOL\SPD\AdventureWorks\bin
project was configured to sign the generated assembly. Signing assemblies              Type sn –T AdventureWorks.dll
allows them to be strongly named and can then be added to the global                   The following will be output: Public key token is [public key token]
assembly cache (GAC). The AdventureWorks assembly will not actually be                    Ex: Public key token is cdd55e263f00449a
added to the GAC, but the VendorAccount user control will need to be
                                                                                     Add VendorAccount.ascx to the AdventureWorks project
configured as safe in Windows SharePoint Services 3.0 and therefore need a
                                                                                       In Visual Studio 2005, in the Solution Explorer right click on
strong name.
                                                                                         AdventureWorks and select Add  Existing Item…
Sn.exe is a utility that can generate key files and retrieve public key tokens         Change the Files of type drop down to All Files (*.*)
from assemblies. It will be used to retrieve the public key of                         Navigate to C:\HOL
AdventureWorks.dll. For more information about sn.exe consult the web site             Select VendorAccount.ascx
http://msdn2.microsoft.com/en-us/library/k5b5tt23(VS.80).aspx.                         Click Add
                                                                                     Modify VendorAccount.ascx to use the VendorAccount class as a code behind
After the public key is retrieved, the VendorAccount.ascx control designed in          In Solution Explorer, double click VendorAccount.ascx
Office SharePoint Designer 2007 earlier in the script will be added to the             Replace the first line of the file (which should be something like <%@
AdventureWorks project and edited to use the VendorAccount class that has                Control Language="C#" ClassName="WebUserControl1" %>) with the
been defined.                                                                            following (replacing [AdventureWorks.dll public key token] with the public
                                                                                         key token found earlier): <%@ Control Language="C#"
                                                                                         ClassName="VendorAccount"
                                                                                         Inherits="AdventureWorks.VendorAccount,AdventureWorks,Version=
                                                                                         1.0.0.0,Culture=neutral,PublicKeyToken=[AdventureWorks.dll public
                                                                                         key token] "%>
                                                                                          Ex: <%@ Control Language="C#" ClassName="VendorAccount"
                                                                                              Inherits="AdventureWorks.VendorAccount,AdventureWorks,Version=1.
                                                                                              0.0.0,Culture=neutral,PublicKeyToken=cdd55e263f00449a"%>
                                                                                 10
                                                                                        Save VendorAccount.ascx by using File  Save
Deploy VendorAccount Files                                                            Open Windows Explorer by using Start  Windows Explorer
                                                                                      Navigate to C:\HOL\AdventureWorks
This section deals with the deployment of the VendorAccount.ascx and                  Right click VendorAccount.ascx and select Copy
VendorAccount.dll for use in the moss.litwareinc.com web application.                 Navigate to C:\Program Files\Common Files\Microsoft Shared\web server
                                                                                       extensions\12\TEMPLATE\CONTROLTEMPLATES
First VendorAccount.ascx must be copied to Windows SharePoint Service’s               Right click inside the folder view and select Paste
control templates directory. User controls in a SharePoint site cannot be             Navigate to C:\HOL\AdventureWorks\bin
referenced (used) in a SharePoint Web Part page. VendorAccount.ascx will              Right click AdventureWorks.dll and select Copy
be referenced from the control templates directory.
                                                                                      Navigate to
                                                                                       C:\Inetpub\wwwroot\wss\VirtualDirectories\moss.litwareinc.com80\bin
The AdventureWorks.dll file generated by the AdventureWorks needs to be
                                                                                      Right click inside the folder view and select Paste
copied to the bin directory of the web application it will be used in order for
ASP .NET to find it. In this instance the web application is
moss.litwareinc.com.
Modify web.config                                                                     In Windows Explorer navigate to
                                                                                       C:\Inetpub\wwwroot\wss\VirtualDirectories\moss.litwareinc.com80
The section covers the modification of the web.config of dashboard page’s             Open web.config Visual Studio 2005 by selecting it and dragging it into Visual
parent web application (moss.litwareinc.com).                                          Studio 2005.
                                                                                      Specify VendorAccount as a safe control
The user control must be registered as safe for Windows SharePoint                      Open the Quick Find dialog by using Edit  Find And Replace  Quick
Services to properly render it. Even though the VendorAccount user control                 Find
is not a Web Part it must still be registered as safe because all controls must         Type </SafeControls> in the Find what textbox and click Find Next
be registered. For more information about registering controls as safe                  Move the cursor to the end of the line above the highlighted text and press
consult the “Register your Web Part as a Safe Control” section of this web                 Enter
site: http://msdn2.microsoft.com/en-us/library/ms948909.aspx                            Add the following line (replacing [AdventureWorks.dll public key token] with
                                                                                           the public key token found earlier): <SafeControl
The trust level of the application must be raised from the default                         Assembly="AdventureWorks, Version=1.0.0.0, Culture=neutral,
WSS_Minimum to WSS_Medium to allow the SQL queries of the code                             PublicKeyToken=[AdventureWorks.dll public key token]"
behind of VendorAccount. For more information about ASP .NET trust levels                  Namespace="AdventureWorks" TypeName="*" Safe="True" />
consult this web site: http://msdn2.microsoft.com/EN-                                       Example: <SafeControl Assembly="AdventureWorks, Version=1.0.0.0,
US/library/wyts434y(VS.80).aspx                                                                Culture=neutral, PublicKeyToken=cdd55e263f00449a"
                                                                                               Namespace="AdventureWorks" TypeName="*" Safe="True" />
                                                                                      Modify the trust level of the application
                                                                                        If the Quick Find dialog was closed, reopen it by using Edit  Find And
                                                                                           Replace  Quick Find
                                                                                        Type <trust level in the Find what textbox and click Find Next
                                                                                        Change the level attribute to WSS_Medium
                                                                                            Ex. <trust level="WSS_Medium" originUrl="" />
                                                                                      Save the file by using File  Save web.config

Add VendorAccount.ascx to Dashboard                                                   Open SharePoint Designer by using Start  All Programs  Microsoft Office
                                                                                        Microsoft SharePoint Designer 2007
In this section, how to add a user to a Web Part page with Office SharePoint            If the site moss.litwareinc.com/sites/advworks is not opened when
                                                                                  11
Designer 2007 will be shown.                                                                 SharePoint Designer starts, close the current site by selecting File  Close
                                                                                             Site
When the VendorAccount.ascx control is added to the page it will resolve to              Open the moss.litwareinc.com/sites/advworks site by selecting File 
an error control. This is because SharePoint does not server site relative                   Open Site
user controls. Adding the control using Office SharePoint Designer 2007 is               Type http://moss.litwareinc.com/sites/advworks in the Site name
useful because it will add most of the necessary logic to the page. The path                 textbox and click Open
(src attribute of the Register tag) of the control can be change to point at the       Open default.aspx by double clicking the file in the Folder List task pane on the
control that was copied to the control templates directory. After changing the          upper left
path, the control will render as designed.                                             Drag VendorAccount.ascx from the Folder List task pane in the upper, left into
                                                                                        the top cell of the table in the Design view of default.aspx
                                                                                       Switch to the Split view of the page by clicking the Split button at the bottom of
                                                                                        the application
                                                                                       Click anywhere inside the Code view of the page
                                                                                       Open the Find and Replace dialog by selecting Edit  Find…
                                                                                       Type VendorAccount.ascx in the Find what textbox and click Find Next
                                                                                       Change the highlighted src attribute’s value from VendorAccount.ascx to
                                                                                        ~/_controltemplates/VendorAccount.ascx
                                                                                       Save the file using File  Save

View Dashboard Page                                                                    In SharePoint Designer, right click on default.aspx in the Folder List task pane
                                                                                        and select Preview in Browser
Now that the VendorAccount user control has been finished and added to the             Select a different vendor name from the vendor account names drop down list
page, view the page in a browser to see how the control functions.                      (acctNameDdList)
                                                                                       Close the browser window after finishing testing the page’s functionality
The VendorAccount user control will default to displaying the International
vendor because it is the vendor returned in the list of vendor retrieved from
the AdventureWorks database.

Selecting different vendor names from the drop down list will post the page
back to the server where the information for the selected vendor name will be
retrieved from the database and populated in the control.


Conclusion

    I.      Conclusion

            By completing this lab you have become familiar with the features inside Microsoft Office SharePoint Designer 2007. This includes all
            the functions available in the design of user controls and import and extending of these controls inside Visual Studio.




                                                                                   12

								
To top