[ASCX] Add an ascx in a webcontrol...

Discussion in 'ASP .Net' started by Quentin, Jul 29, 2003.

  1. Quentin

    Quentin Guest

    hey there,

    ok i made a class, that inherits webcontrol, and i add an htmltable to it. I
    was wondering how to declare an ascx file as an object in my class, like
    that i could change the content (the ascx file) of a cell thanks to a
    property and it would be great :)

    Merci d'avance pour l'aide :)
     
    Quentin, Jul 29, 2003
    #1
    1. Advertising

  2. Quentin

    Quentin Guest

    thank you for your response :)

    But i'm not sure i explained my problem well... I made a class in an other
    file than the aspx one. This class is juste an HtmlTable, it looks like a
    window, and i'd like to add a property to this class as to add an ascx in a
    cell. My english is not so good so let me give you an example.

    --------MesClasses.vb-----------------------

    Public Class MaFenetre : inherits WebControl

    Public Sub New()
    Dim Fenetre As New HtmlTable
    Dim MaLigne As New HtmlTableRow
    Dim MaCellule As New HtmlTableCell
    Dim MyObjectAscx As ?????

    MaCellule.Controls.Add(MyObjectAscx)

    MaLigne.Cells.Add(MaCellule)

    Fenetre.Rows.Add(MaLigne)

    Fenetre.Width = "100%"
    Fenetre.height = "100%"

    Me.Controls.Add(Fenetre)
    End Sub

    Public Property InnerPage As String
    Get
    Return InnerPage
    End Get
    Set(ByVal Value As String)
    InnerPage = Value
    MyObjectAscx.Path = InnerPage
    End Set
    End Property

    End Class

    Where InnerPage is the path of the *.ascx file. But the thing i don't know
    is how to declare the future object that will be the ascx file in my
    class...

    Thank you for your help.

    "Swanand Mokashi" <> a écrit dans le message de
    news: ...
    > say your custom control is called Menu
    >
    > Add this to the aspx page , to which you want to add the web control
    > <%@ Register TagPrefix="Anything" TagName="Menu" SRC="Menu.ascx"%>
    >
    > now in the page
    > <Anything:Menu runat="server" id="Menu1"/>
    >
    > now in page behind
    > Page.FindControl("Menu1").WhateverPropertyMethod
    >
    >
    > HTH
    > --
    > Swanand Mokashi
    > Microsoft Certified Professional
    > http://www.swanandmokashi.com/
    > Home of the Stock Quotes, Quote of the day and Horoscope web services
    > "Quentin" <> wrote in message
    > news:...
    > > hey there,
    > >
    > > ok i made a class, that inherits webcontrol, and i add an htmltable to

    it.
    > I
    > > was wondering how to declare an ascx file as an object in my class, like
    > > that i could change the content (the ascx file) of a cell thanks to a
    > > property and it would be great :)
    > >
    > > Merci d'avance pour l'aide :)
    > >
    > >

    >
    >
     
    Quentin, Jul 29, 2003
    #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. Guest
    Replies:
    2
    Views:
    742
  2. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    208
    Luis Ramírez
    Jul 6, 2004
  3. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    203
    Kasabaarde Sumta
    Dec 13, 2004
  4. Fabricio

    Custom webcontrol that references another webcontrol

    Fabricio, Sep 21, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    191
    Fabricio
    Sep 21, 2005
  5. Peter Morris [Air Software Ltd]

    WebControl with non-WebControl property

    Peter Morris [Air Software Ltd], Dec 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    142
    Peter Morris [Air Software Ltd]
    Dec 7, 2004
Loading...

Share This Page