ASP.NET + Content Pane's and Loading User Control

i want to create a page using vb.net where i have 2 panes, once the user logins in, the left pane will hold a list of links (linkbuttons) that when they click on one it will load a user control into the main pane.  The links list pane is also a user control, is this possible?  and if so how would i do it, i tried putting the code to load the control into the main pane but that didn't work.

thanks
dkilbyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mmarinovCommented:
Hi dkilby,

you have to choose some way of understaning if a user control ( within main pane ) should be visible or not
this you can perform:
1. if your links are HyperLink controls - by sending some querystring parameters
2. if your links are LynkButton controls - give them one event hadler for onclick event and set the CommandName of each control to different values. then within this event hadler you will know which Linkbutton was pressed and which user control within the main pane to show

Regards!
B..M
mmarinov
0
dkilbyAuthor Commented:
i have my default.aspx page with 2 panes, left and content.  if the user is not authenticated then in the left pane the login.ascx user control will load. If they are authenticaed the the menu.ascx user control will load.  The menu.ascx control contains link buttons.  I tried loading a different control into the main content pane on default.aspx from the menu.ascx, but i can't get it to work.

        If Request.IsAuthenticated = False Then
            LeftPane.Controls.Add(Page.LoadControl("~/Modules/login.ascx"))
            LeftPane.Visible = True
        Else
            LeftPane.Controls.Add(Page.LoadControl("~/Modules/Menu.ascx"))
            LeftPane.Visible = True
        End If

Menu.ascx

    Private Sub lnk_csrsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnk_csrsearch.Click
        ContentPane.Controls.Add(Page.LoadControl("~/Modules/csrsearch.ascx"))
        ContentPane.Visible = True
    End Sub

I get the errror "Name 'ContentPane' is not declared."  
0
YZlatCommented:
Private Sub lnk_csrsearch_Click does not recognize ContentPane

try this:

 Private Sub lnk_csrsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnk_csrsearch.Click
       
dim cp as Control
cp=Page.FindControl("ContentPane")

if not cp is nothing then
cp.Controls.Add(Page.LoadControl("~/Modules/csrsearch.ascx"))
        cp.Visible = True

end if
    End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.