Emad Adel Hanna

Microsoft Technical Consultant SharePointAzureOffice365

Using ASP.NET Controls in SharePoint

ASP.NET controls

We can view the controls that are available by opening up the Toolbox task pane and maximizing the ASP.NET Controls option. Within this option, there are six categories of controls. Of these, we can ignore the WebParts option because that is simply a link to the Web Parts task pane.

It should be noted that it is not possible to use ASP.NET WebParts in SharePoint 2007 sites. It is, however, possible for developers to create their new user controls as SmartParts (see http://www.codeplex.com/smartpart) to allow them to be included within WSS and MOSS sites.

The five remaining categories are:

Standard controls

This contains a large number of controls. Most of these are simple, for example:

  • The Image control, which displays a picture.
  • The Label control, which displays text.
  • The Hyperlink control, which we will use to link from our homepage shortly.

In addition, we have standard controls that are somewhat more exciting:

  • The FileUpload control allows files to be uploaded to the server from the user’s computer.
  • The Wizard control allows a multi-step form to be added to our site. At each step of the wizard, the user is asked for different information.
  • The Xml control allows data from an XML document to be displayed on our page (although you may find it easier to use a Data View to display the contents of your XML file).
  • The Calendar control, which we will also add to our site later in this article.

Preparing Your Forms Conversion Using Oracle Application Express (APEX)

Data controls

The data controls allow us to connect to various different data sources, display the results on our page, and update the data in the source.

Because SharePoint already provides us with access to data sources in the Data Source Library task pane, we can safely ignore these controls.

Preparing Your Forms Conversion Using Oracle Application Express (APEX)

Validation controls

The validation controls allow us to validate information input by the user. We will see this in practice towards the end of the article, when we add validation to a form.

Preparing Your Forms Conversion Using Oracle Application Express (APEX)

Navigation controls

The navigation controls provide us with three different methods of helping users navigate our site. The Menu and TreeView controls would allow users to browse to a particular page, while the SiteMapPath control displays breadcrumbs that show their position within the page hierarchy. We will see an example of the Menu control later in this article.

Preparing Your Forms Conversion Using Oracle Application Express (APEX)

Login controls

The login controls allow us to take advantage of ASP.NET’s extensive membership provider system. The benefit of this is that we no longer need to manually create all the elements required by a login system (i.e. registration, login, password reminder, etc.). We will also look at this in detail in this article.

Preparing Your Forms Conversion Using Oracle Application Express (APEX)

Further information about virtually all of the ASP.NET server controls, including examples and code snippets, is available in the ASP.NET Control Reference in the .NET Framework SDK, which is available at.

Adding a simple control

In this article, we will be using various server controls in our pages.

We will start by adding one of the simplest controls to our homepage:

  1. Open the share site in SharePoint Designer.
  2. Open the default.aspx page in Design view.
  3. Make sure that the Standard controls are visible in the Toolbox task pane.
  4. Click on the HyperLink control and drag it onto our page.
  5. Right-click on the control that we have just placed and select Properties from the shortcut menu. This will open the Tag Properties task pane to the left of our design window.
  6. Type View Orders Graph into the Text field in the Tag Properties task pane.
  7. Click on the ellipsis to the right of the NavigateUrl field and select orders.aspx from the list of pages.
  8. Finally, save the page.

The following image shows the Properties shortcut menu that we see as we work through this process:

Preparing Your Forms Conversion Using Oracle Application Express (APEX)

Now, when we open http://olmec/share/ in our browser, we see that the default page links to the Order Graphs.