dynamically displaying .ascx files

B

BK Kim

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
 
P

Peter Rilling

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

Jos

BK said:
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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top