'Error Creating Control' ... 'true' could not be set on property 'ShowRadioButtons'

Last post 07-10-2007 5:09 AM by sujitm. 3 replies.

Sort Posts:

  • 'Error Creating Control' ... 'true' could not be set on property 'ShowRadioButtons'

    07-09-2007, 4:54 AM
    • Member
      332 point Member
    • Bow99
    • Member since 05-19-2004, 10:56 AM
    • Posts 79

    I have created a custom control which inherits from a compositeControl.

    Its all works well in the browser but when I show it in the design mode I geta gray box with the following message

    Error Creating Control - GroupPicker1
    'true' could not be set on property 'ShowRadioButtons'.

    The Property is a fairly standard get and set

    Public Property ShowRadioButtons() As Boolean
                Get
                    Return
    rowRadioButtons.Visible
                End Get
                Set
    (ByVal value As Boolean)
                    EnsureChildControls()
                    rowRadioButtons.Visible = value
                   
                End Set
            End Property

    Any help much appreciated 

     

  • Re: 'Error Creating Control' ... 'true' could not be set on property 'ShowRadioButtons'

    07-10-2007, 3:32 AM
    • Contributor
      3,121 point Contributor
    • sujitm
    • Member since 05-23-2007, 9:01 AM
    • Pune
    • Posts 512

     Hi,

    Try using BrowsableAttribute on the property like:

    <Browable(True)>_
    Public Property ShowRadioButtons() As Boolean

    Is it possible for you to post the source code of the entire control here?

    - Sujit

    Dont forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: 'Error Creating Control' ... 'true' could not be set on property 'ShowRadioButtons'

    07-10-2007, 4:05 AM
    • Member
      332 point Member
    • Bow99
    • Member since 05-19-2004, 10:56 AM
    • Posts 79

    Hi there

    Thanks for your help but the issue seems to not cause me any problems like that now. (I just continued to write the control and work out the design issue later). The only thing I think may have solved it was that I added an ensureChildControl before each set.

    I now have a different issue but along the same lines as the first. Now then I go to the design page I can see my control (now with no error) but when I try and edit the properties for example to change the "ShowTo" property (which is an enumeration) it does not allow me to select using the dropdown to: ShowToAll, it changes the source but not the properties window. Is there somekind of designer attribute?

     

    Oh the code is quite long now (about 700 lines) but here it is.

     

    'Option Strict On
    Imports System
    Imports System.ComponentModel
    Imports System.Drawing
    Imports System.Security.Permissions
    Imports System.Web
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Collections.ObjectModel
    
    Namespace UI
    
    
        < _
            AspNetHostingPermission(SecurityAction.Demand, _
            Level:=AspNetHostingPermissionLevel.Minimal), _
            AspNetHostingPermission(SecurityAction.InheritanceDemand, _
            Level:=AspNetHostingPermissionLevel.Minimal), _
            ToolboxData("<{0}:GroupPicker runat=""Server"" id=""GroupPicker""> </{0}:GroupPicker>") _
        > _
        Public Class GroupPicker
            Inherits CompositeControl
    
    #Region "Event Handling stuff"
    
            Public Event AddButtonClicked(ByVal sender As Object, ByVal e As EventArgs)
            Public Event RemoveButtonClicked(ByVal sender As Object, ByVal e As EventArgs)
            Public Event RadioButtonSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    
    
            Protected Overridable Sub OnAddButtonClicked(ByVal e As EventArgs)
                RaiseEvent AddButtonClicked(Me, e)
            End Sub
    
            Protected Overridable Sub OnRemoveButtonClicked(ByVal e As EventArgs)
                RaiseEvent RemoveButtonClicked(Me, e)
            End Sub
    
            Protected Overridable Sub OnRadioButtonSelectedIndexChanged(ByVal e As EventArgs)
                RaiseEvent RadioButtonSelectedIndexChanged(Me, e)
            End Sub
    
    
    #End Region
    
    
    
    #Region "Variables"
            '------------------UI Table------------------------
    
            Private tabLayoutTable As Table
    
            Private rowRadioButtons As TableRow
            Private cellRadioButtons As TableCell
    
            Private rowHeaderLabels As TableRow
            Private cellLeftHeader As TableCell
            Private cellButtonsHeader As TableCell
            Private cellRightHeader As TableCell
    
            Private rowMainArea As TableRow
            Private cellLeftList As TableCell
            Private cellButtons As TableCell
            Private cellRightList As TableCell
    
            '------------------End of UI Table-----------------
    
            '------------------UI Elements---------------------
    
            Private RbtnShowTo As RadioButtonList
            'Left List
            Private lblLeftListHeading As Label
            Private lbxLeftList As ListBox
    
            'Right List
            Private lbxRightList As ListBox
            Private lblRightListHeading As Label
    
            'Buttons
            Private btnAdd As Button
            Private litBreak As Literal
            Private btnRemove As Button
            '------------------End of UI Elements--------------
    
            '------------------Other Elements------------------
            Private _LeftCollection As Object
            Private _RightCollection As Object
            '------------------End of Other Elements-----------
    
    #End Region
    
            Public Enum ShowToOptions
                NoneSelected = 2
                ShowToAll = 1
                ShowToSpecific = 0
            End Enum
    
    #Region "Properties"
    
    #Region "SkinID properties"
    
            ''' <summary>
            ''' Gets or sets the radio button skinID
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker Skins"), Bindable(True)> _
            Public Property RadioButtonSkinID() As String
                Get
                    Return RbtnShowTo.SkinID
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    RbtnShowTo.SkinID = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the Add button SkinID
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker Skins"), Bindable(True)> _
            Public Property AddButtonSkinID() As String
                Get
                    Return btnAdd.SkinID
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    btnAdd.SkinID = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the Remove Button SkinID
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker Skins"), Bindable(True)> _
            Public Property RemoveButtonSkinID() As String
                Get
                    Return btnRemove.SkinID
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    btnRemove.SkinID = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the Left List Box SkinID
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker Skins"), Bindable(True)> _
            Public Property LeftListSkinID() As String
                Get
                    Return lbxLeftList.SkinID
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lbxLeftList.SkinID = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the Right List Box SkinID
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker Skins"), Bindable(True)> _
            Public Property RightListSkinID() As String
                Get
                    Return lbxRightList.SkinID
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lbxRightList.SkinID = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the Left List Heading SkinID
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker Skins"), Bindable(True)> _
            Public Property LeftListHeadingSkinID() As String
                Get
                    Return lblLeftListHeading.SkinID
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lblLeftListHeading.SkinID = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the Right List Heading SkinID
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RightListHeadingSkinID() As String
                Get
                    Return lblRightListHeading.SkinID
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lblRightListHeading.SkinID = value
                End Set
            End Property
    #End Region
    
    
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RadioButtonShowToAllText() As String
                Get
                    Return RbtnShowTo.Items.FindByValue(1).Text
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    RbtnShowTo.Items.FindByValue(1).Text = value
                End Set
            End Property
    
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RadioButtonShowToSpecificText() As String
                Get
                    Return RbtnShowTo.Items.FindByValue(0).Text
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    RbtnShowTo.Items.FindByValue(0).Text = value
                End Set
            End Property
    
            ''' <summary>
            ''' gets or sets the direction that the radio buttons are displayed
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RadioButtonRepeatDirection() As RepeatDirection
                Get
                    Return RbtnShowTo.RepeatDirection
                End Get
                Set(ByVal value As RepeatDirection)
                    EnsureChildControls()
                    RbtnShowTo.RepeatDirection = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the heading text of the left list
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property LeftListHeadingText() As String
                Get
                    Return lblLeftListHeading.Text
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lblLeftListHeading.Text = value
                End Set
            End Property
    
            ''' <summary>
            ''' Gets or sets the heading text of the right list
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RightListHeadingText() As String
                Get
                    Return lblRightListHeading.Text
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lblRightListHeading.Text = value
                End Set
            End Property
    
            ''' <summary>
            ''' The text displayed on the Add button
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property AddButtonText() As String
                Get
                    Return btnAdd.Text
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    btnAdd.Text = value
                End Set
            End Property
    
            ''' <summary>
            ''' The text displayed on the Remove button
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RemoveButtonText() As String
                Get
                    Return btnRemove.Text
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    btnRemove.Text = value
                End Set
            End Property
    
    
            ''' <summary>
            ''' Populates / Gets the status of the Radio button with either None Selected; Show to all; or Show To Specific
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property ShowTo() As ShowToOptions
                Get
                    If ShowRadioButtons = False Then
                        Return ShowToOptions.ShowToSpecific
                    Else
                        Select Case RbtnShowTo.SelectedValue
                            Case ""
                                Return ShowToOptions.NoneSelected
                            Case 1
                                Return ShowToOptions.ShowToAll
                            Case 0
                                Return ShowToOptions.ShowToSpecific
                        End Select
                    End If
                End Get
                Set(ByVal value As ShowToOptions)
                    EnsureChildControls()
                    Select Case value
                        Case ShowToOptions.NoneSelected
                            RbtnShowTo.SelectedValue = Nothing
                            rowMainArea.Visible = False
                            rowHeaderLabels.Visible = False
                        Case ShowToOptions.ShowToAll
                            RbtnShowTo.SelectedValue = ShowToOptions.ShowToAll
                            rowMainArea.Visible = False
                            rowHeaderLabels.Visible = False
                        Case ShowToOptions.ShowToSpecific
                            RbtnShowTo.SelectedValue = ShowToOptions.ShowToSpecific
                            rowMainArea.Visible = True
                            rowHeaderLabels.Visible = True
                    End Select
                End Set
            End Property
    
    
            '''' <summary>
            '''' Shows or hides the radio buttons. If ShowRadioButton is false then the ShowTo Property will return ShowToSpecific
            '''' </summary>
            '''' <value></value>
            '''' <returns></returns>
            '''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property ShowRadioButtons() As Boolean
                Get
                    Return rowRadioButtons.Visible
                End Get
                Set(ByVal value As Boolean)
                    EnsureChildControls()
                    rowRadioButtons.Visible = value
    
                End Set
            End Property
    
            ''' <summary>
            ''' Turns the CausesValidation property of for when you click the Add and remove buttons so that any other validators on the page do not fire
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property CausesValidation() As Boolean
                Get
                    Return btnAdd.CausesValidation
                End Get
                Set(ByVal value As Boolean)
                    EnsureChildControls()
                    btnAdd.CausesValidation = value
                    btnRemove.CausesValidation = value
                End Set
            End Property
    
            ''' <summary>
            ''' The Collection of information that is to be placed into the Left List
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property LeftCollection() As Object
                Get
                    Dim MyObj As Object = ViewState("LeftCollection")
                    If IsNothing(MyObj) Then
                        Return Nothing
                    Else
                        Return MyObj
                    End If
                End Get
                Set(ByVal value As Object)
                    EnsureChildControls()
                    ViewState("LeftCollection") = value
                End Set
            End Property
    
            ''' <summary>
            ''' The Collection of information that is to be placed into the Right List
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RightCollection() As Object
                Get
                    Dim MyObj As Object = ViewState("RightCollection")
                    If IsNothing(MyObj) Then
                        Return Nothing
                    Else
                        Return MyObj
                    End If
                End Get
                Set(ByVal value As Object)
                    EnsureChildControls()
                    ViewState("RightCollection") = value
                End Set
            End Property
    
            ''' <summary>
            ''' A field name which defines the Left Collection data Value which is placed in the list box (Normally the ID field)
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property LeftCollectionDataValueField() As String
                Get
                    Return lbxLeftList.DataValueField
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lbxLeftList.DataValueField = value
                End Set
            End Property
    
            ''' <summary>
            ''' The field name of the Text displayed in the Left List box
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property LeftCollectionDataTextField() As String
                Get
                    Return lbxLeftList.DataTextField
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lbxLeftList.DataTextField = value
                End Set
            End Property
    
            ''' <summary>
            ''' A field name which defines the Right Collection data Value which is placed in the list box (Normally the ID field)
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RightCollectionDataValueField() As String
                Get
                    Return lbxRightList.DataValueField
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lbxRightList.DataValueField = value
                End Set
            End Property
    
            ''' <summary>
            ''' The field name of the Text displayed in the Right List box
            ''' </summary>
            ''' <value></value>
            ''' <returns></returns>
            ''' <remarks></remarks>
            <Category("DoubleListPicker"), Bindable(True)> _
            Public Property RightCollectionDataTextField() As String
                Get
                    Return lbxRightList.DataTextField
                End Get
                Set(ByVal value As String)
                    EnsureChildControls()
                    lbxRightList.DataTextField = value
                End Set
            End Property
    
    #End Region
    
    #Region "Create child controls"
    
            Protected Overrides Sub CreateChildControls()
                tabLayoutTable = New Table
                tabLayoutTable.ID = "tabLayoutTable"
                'tabLayoutTable.BorderWidth = 1
                tabLayoutTable.SkinID = "DoubleListPicker"
                Me.Controls.Add(tabLayoutTable)
    
                rowRadioButtons = New TableRow
                rowRadioButtons.ID = "rowRadioButtons"
    
                cellRadioButtons = New TableCell
                cellRadioButtons.ID = "cellRadioButtons"
                cellRadioButtons.ColumnSpan = 3
                'cellRadioButtons.BorderWidth = 1
                cellRadioButtons.SkinID = "DoubleListPickerRadio"
                rowRadioButtons.Cells.Add(cellRadioButtons)
    
                rowHeaderLabels = New TableRow
                rowHeaderLabels.ID = "rowHeaderLabels"
    
                cellLeftHeader = New TableCell
                cellLeftHeader.ID = "cellLeftHeader"
                'cellLeftHeader.BorderWidth = 1
                cellLeftHeader.SkinID = "DoubleListPickerLeftListHeader"
                rowHeaderLabels.Cells.Add(cellLeftHeader)
    
                cellButtonsHeader = New TableCell
                cellButtonsHeader.ID = "cellButtonsHeader"
                'cellButtonsHeader.BorderWidth = 1
                cellButtonsHeader.SkinID = "DoubleListPickerButtonHeader"
                rowHeaderLabels.Cells.Add(cellButtonsHeader)
    
                cellRightHeader = New TableCell
                cellRightHeader.ID = "cellRightHeader"
                'cellRightHeader.BorderWidth = 1
                cellRightHeader.SkinID = "DoubleListPickerRightListHeader"
                rowHeaderLabels.Cells.Add(cellRightHeader)
    
                rowMainArea = New TableRow
                rowMainArea.ID = "rowMainArea"
    
                cellLeftList = New TableCell
                cellLeftList.ID = "cellLeftList"
                'cellLeftList.BorderWidth = 1
                cellLeftList.SkinID = "DoubleListPickerLeftList"
                rowMainArea.Cells.Add(cellLeftList)
    
                cellButtons = New TableCell
                cellButtons.ID = "cellButtons"
                'cellButtons.BorderWidth = 1
                cellButtons.SkinID = "DoubleListPickerButtons"
                rowMainArea.Cells.Add(cellButtons)
    
                cellRightList = New TableCell
                cellRightList.ID = "cellRightList"
                'cellRightList.BorderWidth = 1
                cellRightList.SkinID = "DoubleListPickerRightList"
                rowMainArea.Cells.Add(cellRightList)
    
    
                tabLayoutTable.Rows.Add(rowRadioButtons)
                tabLayoutTable.Rows.Add(rowHeaderLabels)
                tabLayoutTable.Rows.Add(rowMainArea)
    
                'Radio buttons
                RbtnShowTo = New RadioButtonList
                RbtnShowTo.ID = "RbtnShowTo"
                RbtnShowTo.Items.Add(New ListItem("Show to all", "1"))
                RbtnShowTo.Items.Add(New ListItem("Show to specific", "0"))
                RbtnShowTo.AutoPostBack = "true"
                RbtnShowTo.SkinID = ""
                AddHandler RbtnShowTo.SelectedIndexChanged, AddressOf RbtnShowTo_SelectedIndexChanged
                cellRadioButtons.Controls.Add(RbtnShowTo)
    
                'Left List
                lblLeftListHeading = New Label
                lblLeftListHeading.ID = "lblLeftListHeading"
                lblLeftListHeading.Text = "Available"
                lblLeftListHeading.SkinID = "LeftList"
                cellLeftHeader.Controls.Add(lblLeftListHeading)
    
                lbxLeftList = New ListBox
                lbxLeftList.ID = "lbxLeftList"
                lbxLeftList.SkinID = "DoubleListPickerLeftList"
                cellLeftList.Controls.Add(lbxLeftList)
    
                'Right List
                lblRightListHeading = New Label
                lblRightListHeading.ID = "lblRightListHeading"
                lblRightListHeading.Text = "Show to"
                lblRightListHeading.SkinID = "RightList"
                cellRightHeader.Controls.Add(lblRightListHeading)
    
                lbxRightList = New ListBox
                lbxRightList.ID = "lbxRightList"
                lbxRightList.SkinID = "DoubleListPickerRightList"
                cellRightList.Controls.Add(lbxRightList)
    
                'Buttons
                btnAdd = New Button
                btnAdd.ID = "btnAdd"
                btnAdd.Text = "Add -->"
                btnAdd.SkinID = "DoubleListPickerAddButton"
                AddHandler btnAdd.Click, AddressOf btnAdd_Click
    
                cellButtons.Controls.Add(btnAdd)
    
                litBreak = New Literal
                litBreak.ID = "litBreak"
                litBreak.Text = "<br/>"
                cellButtons.Controls.Add(litBreak)
    
                btnRemove = New Button
                btnRemove.ID = "btnRemove"
                btnRemove.Text = "<-- Remove"
                btnRemove.SkinID = "DoubleListPickerRemoveButton"
                AddHandler btnRemove.Click, AddressOf btnRemove_Click
                cellButtons.Controls.Add(btnRemove)
    
    
            End Sub
    #End Region
    
    #Region "Methods"
            Public Sub RbtnShowTo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
                Select Case RbtnShowTo.SelectedValue
                    Case ShowToOptions.NoneSelected
                        rowMainArea.Visible = False
                        rowHeaderLabels.Visible = False
                    Case ShowToOptions.ShowToAll
                        rowMainArea.Visible = False
                        rowHeaderLabels.Visible = False
                    Case ShowToOptions.ShowToSpecific
                        rowMainArea.Visible = True
                        rowHeaderLabels.Visible = True
                End Select
                'Runs the raiseevent which is where the developer can incorporate their own actions
                RaiseEvent RadioButtonSelectedIndexChanged(sender, e)
            End Sub
    
            Public Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs)
                Dim TempleftCollection As Object
                TempleftCollection = LeftCollection
                Dim TempRightCollection As Object
                TempRightCollection = RightCollection
    
                Dim Counter As Integer = 0
                For Each MyLeftDataListItem As ListItem In lbxLeftList.Items
                    If MyLeftDataListItem.Selected = True Then
                        TempRightCollection.add(LeftCollection.item(Counter))
                        TempleftCollection.removeAt(Counter)
                    Else
                        Counter = Counter + 1
                    End If
                Next
    
                lbxLeftList.DataSource = TempleftCollection
                lbxLeftList.DataBind()
    
                lbxRightList.DataSource = TempRightCollection
                lbxRightList.DataBind()
                'Runs the raiseevent which is where the developer can incorporate their own actions
                RaiseEvent AddButtonClicked(sender, e)
            End Sub
    
    
            Public Sub btnRemove_Click(ByVal sender As Object, ByVal e As System.EventArgs)
                Dim TempleftCollection As Object
                TempleftCollection = LeftCollection
                Dim TempRightCollection As Object
                TempRightCollection = RightCollection
    
                Dim Counter As Integer = 0
                For Each MyRightDataListItem As ListItem In lbxRightList.Items
                    If MyRightDataListItem.Selected = True Then
                        TempleftCollection.add(RightCollection.item(Counter))
                        TempRightCollection.removeAt(Counter)
                    Else
                        Counter = Counter + 1
                    End If
                Next
    
                lbxLeftList.DataSource = TempleftCollection
                lbxLeftList.DataBind()
    
                lbxRightList.DataSource = TempRightCollection
                lbxRightList.DataBind()
                'Runs the raiseevent which is where the developer can incorporate their own actions
                RaiseEvent RemoveButtonClicked(sender, e)
            End Sub
    
    
    
    
    
    
    
            ''' <summary>
            ''' Loads in the collections into the control. This needs to be run the first time the control is loaded
            ''' </summary>
            ''' <remarks></remarks>
            Sub LoadControlData()
                EnsureChildControls()
                'Load in the left List
                lbxLeftList.DataValueField = Me.LeftCollectionDataValueField
                lbxLeftList.DataTextField = Me.LeftCollectionDataTextField
                lbxLeftList.DataSource = LeftCollection
                lbxLeftList.DataBind()
    
                'Load in th eright List
                lbxRightList.DataValueField = Me.RightCollectionDataValueField
                lbxRightList.DataTextField = Me.RightCollectionDataTextField
                lbxRightList.DataSource = RightCollection
                lbxRightList.DataBind()
    
    
    
            End Sub
    #End Region
    
            Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
                tabLayoutTable.RenderControl(writer)
            End Sub
    
    
        End Class
    End Namespace
    
    
     
  • Re: 'Error Creating Control' ... 'true' could not be set on property 'ShowRadioButtons'

    07-10-2007, 5:09 AM
    Answer
    • Contributor
      3,121 point Contributor
    • sujitm
    • Member since 05-23-2007, 9:01 AM
    • Pune
    • Posts 512

    Hi,

    I changed the property as following and it is working now. The problem was that you were using RadioButtonList for storing the value of ShowTo property. Remember all the child controls in CompositeControl are created every time a property is changed in design time. So the value set by user was getting lost. Use the following code as baseline and improve it to incorporate your logic.

    <Category("DoubleListPicker"), Bindable(True)> _
            Public Property ShowTo() As ShowToOptions
                Get
                    Return
    ViewState("ShowTo")

                    If ShowRadioButtons = False Then
                        Return
    ShowToOptions.ShowToSpecific
                    Else
                        Select Case
    RbtnShowTo.SelectedValue
                            Case ""
                                Return ShowToOptions.NoneSelected
                            Case 1
                                Return ShowToOptions.ShowToAll
                            Case 0
                                Return ShowToOptions.ShowToSpecific
                        End Select
                    End If
                End Get
                Set
    (ByVal value As ShowToOptions)
                    EnsureChildControls()
                    ViewState("ShowTo") = value
                    Select Case value
                        Case ShowToOptions.NoneSelected
                            RbtnShowTo.SelectedValue = Nothing
                            rowMainArea.Visible = False
                            rowHeaderLabels.Visible = False
                        Case
    ShowToOptions.ShowToAll
                            RbtnShowTo.SelectedValue = ShowToOptions.ShowToAll
                            rowMainArea.Visible = False
                            rowHeaderLabels.Visible = False
                        Case
    ShowToOptions.ShowToSpecific
                            RbtnShowTo.SelectedValue = ShowToOptions.ShowToSpecific
                            rowMainArea.Visible = True
                            rowHeaderLabels.Visible = True
                    End Select
                End Set
            End Property

     
    - Sujit

    Dont forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Page 1 of 1 (4 items)