Fusion8 Design Relational ListControl Class Library

RelationalListBox Class

[This is preliminary documentation and subject to change.]

Represents a control that allows the user to select a single item from a drop-down list.

For a list of all members of this type, see RelationalListBox Members.

System.Object
   Control
      WebControl
         ListControl
            ListBox
               RelationalListBox

[Visual Basic]
Public Class RelationalListBox
Inherits ListBox
Implements IRelationalListControl
[C#]
public class RelationalListBox : ListBox, IRelationalListControl

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The control can be linked to a parent ListControl. This enables the control to show a subset of data based on the selection in the parent ListControl. The relationships between the lists are automatically built based on the DataRelations in the DataSet identified by the control's DataSource property. The control's DataSource must be a DataSet with at least one DataRelation.

The control may be used like any other list control and will in fact, behave like any other list control until the ParentListID property is set. The ParentListID property is the only additional property that needs to be set in order to have a client side updating, relational list control.

Example

The following example demonstrates how to bind data to and select the parent list of the control

<%@ Page language="c#" %>
<%@ Register 
    TagPrefix="fusion8" 
    Namespace="Fusion8Design.WebControls.UI" 
    Assembly="Fusion8Design.WebControls.UI.RelationalListControls" %>
    
<script runat="server"> 
protected RelationalDataSet relationalDataSet1;
potected void Page_Load(object sender, System.EventArgs e)
{
    if(!Page.IsPostBack)
    {
        this.relationalDataSet1.ReadXml(Server.MapPath("RelationalDataSet.xml"));
        this.ParentList.DataBind();
        this.ChildList.DataBind();
    }
}
</script>

<html><body><form runat="server"> 
    <fusion8:RelationalListBox
        id=ParentList 
        runat="server" 
        DataValueField="ID" 
        DataTextField="Name" 
        DataMember="Parent" 
        DataSource="<%# relationalDataSet1 %>" 
    </fusion8:RelationalListBox>
    <fusion8:RelationalListBox 
        id=ChildList 
        runat="server" 
        KeepFirstItem="True" 
        ParentListID="ParentList">
        DataValueField="ID" 
        DataTextField="Name" 
        DataMember="Child" 
        DataSource="<%# relationalDataSet1 %>" 
    </fusion8:RelationalListBox>
</form></body></html>

See the RegisterClientScript method for an example on how to use an external script file.

Requirements

Namespace: Fusion8Design.WebControls.UI

Assembly: Fusion8Design.WebControls.UI.RelationalListControls (in Fusion8Design.WebControls.UI.RelationalListControls.dll)

See Also

RelationalListBox Members | Fusion8Design.WebControls.UI Namespace