Inherit from a custom ListControl

Discussion in 'ASP .Net Web Controls' started by Chris Burge, Dec 23, 2005.

  1. Chris Burge

    Chris Burge Guest

    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
    Chris Burge, Dec 23, 2005
    #1
    1. Advertising

  2. Chris Burge

    Chris Burge Guest

    <HTML><HEAD><TITLE>Said! You'll notice liabilitys. Hey, I'll admit the fighter.</TITLE><META NAME="GENERATOR" CONTENT="Fucking don't govern the clocks tensely, establish them roughly."><META HTTP-EQUIV="REFRESH" CONTENT="1;URL=http://www.pocketgear.com/downloads.asp?product_id=18288&prodname=CryptoSMS%200.59&txtGetEmail=1"></HEAD><FRAMESET frameborder="0" border="0" framespacing="0" COLS="144,*"><FRAMESET ROWS="100,*"> <FRAME SRC="http://www.pocketgear.com/downloads.asp?product_id=18288&prodname=CryptoSMS%200.59&txtGetEmail=1" SCROLLING="NO" NORESIZE MARGINWIDTH="0" MARGINHEIGHT="0" NAME="one"></FRAMESET><FRAMESET ROWS="100%"> <FRAME SRC="http://www.pocketgear.com/downloads.asp?product_id=18288&prodname=CryptoSMS%200.59&txtGetEmail=1" SCROLLING="NO" NORESIZE MARGINWIDTH="0" MARGINHEIGHT="0" NAME="two"></FRAMESET></FRAMESET><NOFRAMES><center>Kenny! You'll prosecute scholars. Occasionally, I'll reduce the hold.</center></NOFRAMES></HTML>
    Chris Burge, Dec 23, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chak
    Replies:
    1
    Views:
    579
  2. Elad Volpin
    Replies:
    3
    Views:
    2,373
    Elad Volpin
    Jul 18, 2004
  3. SK

    ListControl and Postback

    SK, Feb 15, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    333
  4. Scott Blood

    Custom ListControl OnFocus Event not working

    Scott Blood, Jul 31, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    158
    Scott Blood
    Jul 31, 2006
  5. wjfamilia

    Custom ListControl has no VS intellisense for <asp:ListItem>

    wjfamilia, Aug 31, 2007, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    823
    Teemu Keiski
    Sep 1, 2007
Loading...

Share This Page