C
Chris Burge
Ok, I have just spent the past little while trying to figure this out.
I think I know what my solution may have to be but I'm not sure how to
even to go about to do that. Anywho, here is my Christmas question.
All of my lsitcontrols (dropdownlist, listbox, etc.) have the same set
of custom attributes needed. Now I could write these as properties for
each control or I could, smartly, add the properties to a custom
ListControl class which they all inherit from. The problem is that
they now can't draw what is needed unless I write a custom render
method for each one (so I assume). Anywho, I wouldn't even know how to
go about that and not loose current functionality provided by
Microsoft. Of course, this would probably be easier if we were allowed
multiple inheritance but no dice. Below is my code for the two classes
that I'm quickly pasting up here as my co-workers are trying to give me
the bumb-rush out so we can go home for Christmas! LOL.
The Custome ListControl:
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.IO
Imports System.Text
Imports System.Collections
'/ <summary>
'/ IPGListControl
'/ Simple control that renders a ListControl with OwnerTypeId
'/ </summary>
<ToolboxData("<{0}:IPGListControl runat=server></{0}:IPGListControl>")>
_
Public Class IPGListControl
Inherits System.Web.UI.WebControls.ListControl
Private _ownerTypeId As Integer
Private _optionalTextBox As Boolean
Private _optionalTextBoxName As String
Private _defaultValue As String
Public Sub New()
End Sub
Public Property OwnerTypeId() As Integer
Get
OwnerTypeId = _ownerTypeId
End Get
Set(ByVal Value As Integer)
_ownerTypeId = Value
End Set
End Property
Public Property OptionalTextBox() As Boolean
Get
OptionalTextBox = _optionalTextBox
End Get
Set(ByVal Value As Boolean)
_optionalTextBox = Value
End Set
End Property
Public Property OptionalTextBoxName() As String
Get
OptionalTextBoxName = _optionalTextBoxName
End Get
Set(ByVal Value As String)
_optionalTextBoxName = Value
End Set
End Property
Public Property DefaultValue() As String
Get
DefaultValue = _defaultValue
End Get
Set(ByVal Value As String)
_defaultValue = Value
End Set
End Property
End Class
The Custom DropDownList inherited from IPGListControl
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.IO
Imports System.Text
Imports System.Collections
'/ <summary>
'/ IPGDropDownList
'/ Simple control that renders a DropDownList with OwnerTypeId
'/ </summary>
<ToolboxData("<{0}:IPGDropDownList
runat=server></{0}:IPGDropDownList>")> _
Public Class IPGDropDownList
Inherits IPGListControl
End Class
If Obi' Wan is there, you're my only hope. LOL
Thanks,
Chris
I think I know what my solution may have to be but I'm not sure how to
even to go about to do that. Anywho, here is my Christmas question.
All of my lsitcontrols (dropdownlist, listbox, etc.) have the same set
of custom attributes needed. Now I could write these as properties for
each control or I could, smartly, add the properties to a custom
ListControl class which they all inherit from. The problem is that
they now can't draw what is needed unless I write a custom render
method for each one (so I assume). Anywho, I wouldn't even know how to
go about that and not loose current functionality provided by
Microsoft. Of course, this would probably be easier if we were allowed
multiple inheritance but no dice. Below is my code for the two classes
that I'm quickly pasting up here as my co-workers are trying to give me
the bumb-rush out so we can go home for Christmas! LOL.
The Custome ListControl:
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.IO
Imports System.Text
Imports System.Collections
'/ <summary>
'/ IPGListControl
'/ Simple control that renders a ListControl with OwnerTypeId
'/ </summary>
<ToolboxData("<{0}:IPGListControl runat=server></{0}:IPGListControl>")>
_
Public Class IPGListControl
Inherits System.Web.UI.WebControls.ListControl
Private _ownerTypeId As Integer
Private _optionalTextBox As Boolean
Private _optionalTextBoxName As String
Private _defaultValue As String
Public Sub New()
End Sub
Public Property OwnerTypeId() As Integer
Get
OwnerTypeId = _ownerTypeId
End Get
Set(ByVal Value As Integer)
_ownerTypeId = Value
End Set
End Property
Public Property OptionalTextBox() As Boolean
Get
OptionalTextBox = _optionalTextBox
End Get
Set(ByVal Value As Boolean)
_optionalTextBox = Value
End Set
End Property
Public Property OptionalTextBoxName() As String
Get
OptionalTextBoxName = _optionalTextBoxName
End Get
Set(ByVal Value As String)
_optionalTextBoxName = Value
End Set
End Property
Public Property DefaultValue() As String
Get
DefaultValue = _defaultValue
End Get
Set(ByVal Value As String)
_defaultValue = Value
End Set
End Property
End Class
The Custom DropDownList inherited from IPGListControl
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.IO
Imports System.Text
Imports System.Collections
'/ <summary>
'/ IPGDropDownList
'/ Simple control that renders a DropDownList with OwnerTypeId
'/ </summary>
<ToolboxData("<{0}:IPGDropDownList
runat=server></{0}:IPGDropDownList>")> _
Public Class IPGDropDownList
Inherits IPGListControl
End Class
If Obi' Wan is there, you're my only hope. LOL
Thanks,
Chris