Solved

User control not loading

Posted on 2006-06-16
2
347 Views
Last Modified: 2008-02-01
I've got a user control that I have created named ContentPane. The page is very simplistic yet it is not showing up on the page when the page loads. I've tried to add the control to the page using the designer, and at run-time and I have no luck either way. I have placed some code in the page_load of the control to add a label to the control and I set a break point there. The event fires, and everything looks fine, but it does not get rendered. I'll include the code that I am using for the user control. I think it is pretty funny that my content pane won't show any content. It's kind of ironic.

User control Html:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="ContentPane.ascx.vb" Inherits="PeCON.PresentationLayer.ContentPane" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<div align="center" class="ContentPane" id="divContent" runat="server">
      <img class="ContainerTopLeft" src="images\cont-tl.gif">
      <img class="ContainerTopRight" src="images\cont-tr.gif">
      <img class="ContainerBottomLeft" src="images\cont-bl.gif">
      <img class="ContainerBottomRight" src="images\cont-br.gif">
      
      Hello!!!!!!
</div>


User control code-behind:
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace PresentationLayer
    Public Class ContentPane
        Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

        'This call is required by the Web Form Designer.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        End Sub
        Protected WithEvents divContent As System.Web.UI.HtmlControls.HtmlGenericControl

        'NOTE: The following placeholder declaration is required by the Web Form Designer.
        'Do not delete or move it.
        Private designerPlaceholderDeclaration As System.Object

        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
        End Sub

#End Region

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
            Dim requestValues As New Label

            For Each name As String In Request.ServerVariables
                requestValues.Text += name & " = " & Request.ServerVariables(name) & "<BR>"
            Next

            divContent.Controls.Add(requestValues)
        End Sub

        Public Overrides ReadOnly Property Controls() As ControlCollection
            Get
                Return divContent.Controls
            End Get
        End Property
    End Class
End Namespace
0
Comment
Question by:fizch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Author Comment

by:fizch
ID: 16921260
Nevermind. I found that overriding the Controls property was creating problems. When I changed it to not override the controls property of the base class, it worked. Here is my solution.

        Public ReadOnly Property Content() As ControlCollection
            Get
                Return divContent.Controls
            End Get
        End Property
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 16922470
Closed, 500 points refunded.
Netminder
Site Admin
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question