# .NET and More > Silverlight >  Hiding login controls after a successful login

## trevorjeaton

Hi folks,

I've been scratching and clawing my way forward to authenticate to a table in an existing database using silverlight 4 and have finally succeeded in the logic (the efforts are in this thread: http://www.vbforums.com/showthread.php?t=616597), but now in practice i need to figure out how to get the flow of the app correct.

My users mainpage.xaml is a username and password login and upon successful credentials i want to redirect them to a "Dashboard" page that contains the true navigation framework that you can google all over the web.

Right now, when my user successfully logs in, the dasboard is displayed directly beneath the username and password boxes, when in fact they should disappear at that point and allow them in to the app.

in my xaml for the mainpage i have a reference to the navigation framework as follows:



```

xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
```

and i also have a navigation frame simply called MainFrame that i dropped on to the grid as well:



```

<navigation:Frame x:Name="MainFrame" HorizontalContentAlignment = "Stretch" VerticalContentAlignment = "Stretch" Margin="20" />
```

and then finally in my codebehind when the user clicks the login button, it checks the database via the web configfile and gets the results if a user and password of that combination exist, and then lets them in or denies them as follows:



```

Private Sub invokeOperation_Completed(ByVal Sender As Object, ByVal E As EventArgs)
        If invokeop.Value = 1 Then
            'navigate to the main page
            Me.MainFrame.Navigate(New Uri("/Views/Dashboard.xaml", UriKind.Relative))
        Else
            MessageBox.Show("Invalid credentials", "Try again", MessageBoxButton.OK)
        End If
    End Sub
```

my problem is that on my "Dashboard" page, I've just stubbed it out with a label saying "Application coming soon...." and i want that to be a new page in the browser - eventually that will be the bread and butter of the app.

Right now, the username label and textbox and password label and textbox and even the button with "Login" on it all stay right where they are and the 'coming soon' message just pops up right underneath them after a successfull login.....

how do i get the login page to vanish via either hiding the controls before moving forward or even better, redirecting to a new page?

as usual, any help is appreciated.

thx everyone

----------


## trevorjeaton

okay so hiding the controls seems fairly straightforward - i came up with the following using the visibility.collapsed approach:



```

Private Sub invokeOperation_Completed(ByVal Sender As Object, ByVal E As EventArgs)
        If invokeop.Value = 1 Then
            'navigate to the main page

            Label1.Visibility = System.Windows.Visibility.Collapsed
            Label2.Visibility = System.Windows.Visibility.Collapsed
            tbUserName.Visibility = System.Windows.Visibility.Collapsed
            pbPassword.Visibility = System.Windows.Visibility.Collapsed
            btnLogin.Visibility = System.Windows.Visibility.Collapsed

            Me.MainFrame.Navigate(New Uri("/Views/Dashboard.xaml", UriKind.Relative))

        Else
            MessageBox.Show("Invalid credentials", "Try again", MessageBoxButton.OK)
        End If

End Sub
```

but still, ideally, a new page of it's own would be better - it also errors out when i hit the back button on the browser as well......

----------

