Microsoft.SharePoint.WebCon ...


DVRadioButtonList Class (Microsoft.SharePoint.WebControls)

Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class DVRadioButtonList
    Inherits RadioButtonList
    Implements IDesignerEventAccessor
Visual Basic (Usage)
Dim instance As DVRadioButtonList
C#
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public sealed class DVRadioButtonList : RadioButtonList, IDesignerEventAccessor
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.BaseDataBoundControl
         System.Web.UI.WebControls.DataBoundControl
           System.Web.UI.WebControls.ListControl
             System.Web.UI.WebControls.RadioButtonList
              Microsoft.SharePoint.WebControls.DVRadioButtonList
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Tags :


Community Content

Adam Buenz - MVP
DVRadioButtonList

Description

The Microsoft.SharePoint.WebControls.DVRadioButtonList class inherits from the System.Web.UI.WebControls.CheckBoxList class to create a data source bindable multi-selection check box represented by RadioButtons list as well as the Microsoft.SharePoint.WebControls.IDesignerEventAccessor interface to contract two members, OnDesignerLoad and OnDesignerPreRender. Since the ASP.NET ControlDesigner doesn’t call OnLoad or OnPreRender when requesting control preview generation and OnInit and OnPreRender are both protected, the control designer can’t directly call OnInit and OnPreRender. Therefore the interface is used to circumvent this shortcoming. For the DVRadioButtonList the design lifecycle is particularly important because this control is exposed through SharePoint Designer.

DVRadioButtonList relies primarily on its RadioButtonList class inheritance for a majority of its functionality, however overriding the PerformDataBinding method and the SelectedValue property for full support in SharePoint Designer.

It should be noted that the because of the "DV" prefix on the DVRadioButtonList class name this class implies extension of a pre-existing SharePoint or ASP.NET class targeted for Data View (DV) usage.

Usage Scenario

The primary usage of the DVRadioButtonList control can be found with SharePoint Designer (SPD). Within the provided “SharePoint Controls” section in the SPD ToolBox, under the “Data View Controls” category the control is represented under the title “DataView Radio Button list”.Within managed code, the object finds little use since it is sealed so locked for inheritance, and trivial inheritance on the RadioButtonList class provides extension of further object attributes if required. However, use is analogous to any WebControl.

In the below example, MyClass is inheriting from the System.Web.UI.WebControls.WebParts.WebPart class and its CreateChildControls method is being overridden. Following, a new DVRadioButtonList object is being created with its ID property being set to something unique. The DVRadioButtonList.DataSourceID is set to an ID that represents a separate ObjectDataSource object which has been created with a specified typename and select method and added to the control collection. Following, the DVRadioButtonList.DataBind method is called. Subsequently, the hydrated control is being added to the current instance control collection.

C# Code Example

public class MyClass : WebPart
{
protected override void CreateChildControls()
{
ObjectDataSource mySource = new ObjectDataSource("MyType", "SelectMethod");
mySource.ID = "ListDataSource";
Controls.Add(mySource);
DVRadioButtonList list = new DVRadioButtonList();
list.ID = "RadioButtonList";
list.DataSourceID = "ListDataSource";
list.DataBind();
Controls.Add(list);
base.CreateChildControls();
}
}

VB.NET Code Example

Public Class [MyClass]
Inherits WebPart
Protected Overloads Overrides Sub CreateChildControls()
Dim mySource As New ObjectDataSource("MyType", "SelectMethod")
mySource.ID = "ListDataSource"
Controls.Add(mySource)
Dim list As New DVRadioButtonList()
list.ID = "RadioButtonList"
list.DataSourceID = "ListDataSource"
list.DataBind()
Controls.Add(list)
MyBase.CreateChildControls()
End Sub
End Class
Tags :

Page view tracker