Simple Class Question

Discussion in 'ASP .Net' started by Shapper, Oct 10, 2005.

  1. Shapper

    Shapper Guest

    Hello,

    I have a class which I am calling as follows:
    ...
    column.ItemTemplate = CreateItemTemplate()
    ...
    Function CreateItemTemplate() As ITemplate
    Return New ItemTemplate
    End Function
    ...

    Class ItemTemplate
    Implements ITemplate
    ReadOnly Property ITemplate_dptpt() As HtmlControl
    Get
    Dim _dptpt As HtmlControl
    _dptpt = New HtmlGenericControl
    _dptpt.Attributes.Add("class", "dptpt")
    Return _dptpt
    End Get
    End Property

    ReadOnly Property ITemplate_dengb() As HtmlControl
    Get
    ' Div: dengb
    Dim _dengb As HtmlControl
    _dengb = New HtmlGenericControl
    _dengb.Attributes.Add("class", "dengb")
    Return _dengb
    End Get
    End Property

    Public Sub InstantiateIn(ByVal container As Control) Implements
    ITemplate.InstantiateIn

    container.Controls.Add(ITemplate_dptpt)
    container.Controls.Add(ITemplate_dengb)

    End Sub 'InstantiateIn

    End Class

    What I need is to add ITemplate_dptpt OR ITemplate_dengb according to
    the value in Session("culture").

    I think the best way is to use only one class, i.e., ItemTemplate and
    try some how to have some king of condition inside the class.

    How can I do this?

    Thanks,
    Miguel
     
    Shapper, Oct 10, 2005
    #1
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.