Results 1 to 2 of 2

Thread: User Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Kuala Lumpur, Malaysia
    Posts
    3

    User Control

    I'm about to create a portal. I would like to know are there any possible ways of including a sidebar in my page?

    The sidebar will have to run functions and retrieve data from database, i've used "include virtual" to include another form as a sidebar, but it can't support multiple forms in one page.

    Is using a customised user control an easier way? I'll have to create a sidebar and include it as an user control in everypage, will it be possible to pass session around if i click a link from the side bar?

    Thanks!

  2. #2
    New Member
    Join Date
    Dec 2002
    Posts
    4
    You can put a placeholder where ever you want to load the control. for example:

    in your aspx page you could have something like:
    html code....
    <asp:PlaceHolder id="phContent" runat="server" />
    html code....


    Then create a control (.ascx) with the content and code you need.

    in the code behind of your ascx you can place any code that you need to be processed, including session information.

    In your code behind for you .aspx page you can simply call have in VB:
    Protected WithEvents phContent As PlaceHolder

    Private Sub Page_Load....
    phContent.Controls.Clear()
    phContent.Controls.Add(LoadControl("path/yourcontrol.ascx"))
    End Sub


    - Justin_

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width