Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

User control not loading

Posted on 2006-06-16
2
Medium Priority
?
350 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

719 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