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

Discussion in 'ASP .Net Web Controls' started by redraven, Mar 10, 2005.

  1. redraven

    redraven Guest

    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
     
    redraven, Mar 10, 2005
    #1
    1. Advertising

  2. redraven

    Mythran Guest

    "redraven" <> wrote in message
    news:...
    > 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
     
    Mythran, Mar 10, 2005
    #2
    1. Advertising

  3. redraven

    redraven Guest

    Good idea!

    Thanks for the help!
     
    redraven, Mar 11, 2005
    #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. Doris Cox
    Replies:
    0
    Views:
    564
    Doris Cox
    Dec 2, 2003
  2. Jeff Smythe
    Replies:
    3
    Views:
    1,328
    Jeff Smythe
    Jan 2, 2004
  3. jnickfl1
    Replies:
    0
    Views:
    635
    jnickfl1
    Sep 18, 2006
  4. archana
    Replies:
    0
    Views:
    376
    archana
    Mar 13, 2007
  5. pek
    Replies:
    0
    Views:
    1,239
Loading...

Share This Page