How do you do a <%if Session["pg"] == 1 %> in asp.net and c#

R

redraven

Hi,

I'd like to display different user controls on a single page/form.

I know in asp.net and vb you can just go
<%If Session("pg") = 1 Then%>
.... my usercontrol
<%Else%>
.... my other usercontrol
<%End if%>

How do you do this in c#?

Any help with this issue will be greatly appreciated!

Thanks for reading,
Andre
 
M

Mythran

redraven said:
Hi,

I'd like to display different user controls on a single page/form.

I know in asp.net and vb you can just go
<%If Session("pg") = 1 Then%>
... my usercontrol
<%Else%>
... my other usercontrol
<%End if%>

How do you do this in c#?

Any help with this issue will be greatly appreciated!

Thanks for reading,
Andre

Sub Page_Load(...)
If Session("pg") = 1 Then
myUserControl.Visible = True
myOtherUserControl.Visible = False
Else
myUserControl.Visible = False
myOtherUserControl.Visible = True
End If
End Sub

Hope this helps...

Mythran
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top