dynamically displaying .ascx files

Discussion in 'ASP .Net' started by BK Kim, Feb 28, 2004.

  1. BK Kim

    BK Kim Guest

    Hello.

    I have made some .ascx files which displays some data.

    What I am trying to do is in my .aspx file, I dynamically display a.ascx
    file or b.ascx file depend on who logs in.

    Is there any way I can achieve this?

    Thanx in advance
     
    BK Kim, Feb 28, 2004
    #1
    1. Advertising

  2. If you only have two controls that need to be swapped out, simply set the
    Visible property according to what you want displayed.

    "BK Kim" <> wrote in message
    news:O4JHAya$...
    > Hello.
    >
    > I have made some .ascx files which displays some data.
    >
    > What I am trying to do is in my .aspx file, I dynamically display a.ascx
    > file or b.ascx file depend on who logs in.
    >
    > Is there any way I can achieve this?
    >
    > Thanx in advance
    >
    >
     
    Peter Rilling, Feb 28, 2004
    #2
    1. Advertising

  3. BK Kim

    Jos Guest

    BK Kim wrote:
    > Hello.
    >
    > I have made some .ascx files which displays some data.
    >
    > What I am trying to do is in my .aspx file, I dynamically display
    > a.ascx file or b.ascx file depend on who logs in.
    >
    > Is there any way I can achieve this?
    >
    > Thanx in advance


    Apart from Peter's solution (which is easier if you need post back
    from your user control), this is another way (VB):

    If(user="John") Then
    Dim c1 As Control = LoadControl("a.ascx")
    Page.Controls.Add(c1)
    Else
    ....
    End If

    --

    Jos
     
    Jos, Feb 28, 2004
    #3
    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. Quentin
    Replies:
    1
    Views:
    489
    Quentin
    Jul 29, 2003
  2. Jason Shohet
    Replies:
    1
    Views:
    485
    Kevin Spencer
    Nov 10, 2003
  3. Holger (David) Wagner
    Replies:
    2
    Views:
    1,944
    Holger (David) Wagner
    Jul 3, 2004
  4. Joe
    Replies:
    1
    Views:
    375
    Jeffrey Tan[MSFT]
    Feb 16, 2004
  5. Replies:
    2
    Views:
    539
Loading...

Share This Page