This topic has not yet been rated - Rate this topic

DialogMaster Class

Represents the base class that contains the methods and properties for a dialog control on a master page.

System.Object
  System.Web.UI.Control
    System.Web.UI.TemplateControl
      System.Web.UI.UserControl
        System.Web.UI.MasterPage
          Microsoft.SharePoint.WebControls.DialogMaster

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class DialogMaster : MasterPage

This class is for the style of UI used in a Microsoft SharePoint Foundation 2010 master page.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
DialogMaster
Description

The Microsoft.SharePoint.WebControls.DialogMaster class inherits from the System.Web.UI.MasterPage class which is accountable for the affording template support and assimilation of System.Web.UI.WebControls.Content objects along with their associated child controls. The DialogMaster class is heavily represented within the shipped version of SharePoint in numerous interfaces, mostly notably with “Picker” objects. For custom development, if a requirement is to use the dialog.master master page to build a custom dialog, the DialogMaster class should be leveraged.

A majority of DialogMaster functionality relies on its derivation; however particular consideration is given to events in order to supply a suitable event based dialog experience. For this motive, there is vacant OkButton_Click event that can be wired to execute an arbitrary set of logic. 

The Usage Scenario

The most ordinary usage of DialogMaster is to construct your own custom dialogs inclusive of capturing the related events. While there is heavy representation of DialogMaster internally within SharePoint, it is a useful control for custom development particularly when building SharePoint Application Pages.

In the below, I am demonstrating a class inheriting from the Page class (which would be ordinary when developing custom SharePoint Application Pages). Since the button belongs to dialog.master, we are wiring the btnOk_Click event handler to an empty method call in the overridden OnInit method.

C# Code Example

public class MsdnPage : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
((DialogMaster)this.Page.Master).OkButton.Click += btnOk_Click;
base.OnInit(e);
}
protected void btnOk_Click(object sender, EventArgs e)
{
// do stuff

}

Visual Basic .NET Code Example

Public Class MsdnPage
Inherits System.Web.UI.Page
Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)
AddHandler DirectCast(Me.Page.Master, DialogMaster).OkButton.Click, AddressOf btnOk_Click
MyBase.OnInit(e)

End Sub
Protected Sub btnOk_Click(ByVal sender As Object, ByVal e As EventArgs)
' do stuff
End Sub

End Class