473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

custom control - doesn't show

Hi..

I'm trying to create small custom control.. class definition in vb looks
like:

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Resources
Imports System.ComponentMode
Imports Anthem

Namespace WebContr.WebControls

Public Class DynamicList
Inherits System.Web.UI.WebControls.WebControl
Implements INamingContainer
Protected Overloads Sub CreateChildControls()
Me.Controls.Clear()
Me.InitializeComponent()
End Sub

''' <summary>
''' Initializes the contained controls
''' </summary>
Private Sub InitializeComponent()

listBox = New Anthem.ListBox()
btUp = New Anthem.Button
btDown = New Anthem.Button

Me.btDown.Text = "Down"
Me.btUp.Text = "Up"

listBox.Visible = True
btUp.Visible = True
btDown.Visible = True

Me.Controls.Add(listBox)
Me.Controls.Add(btUp)
Me.Controls.Add(btDown)

End Sub

Protected Overloads Sub Render(ByVal render As HtmlTextWriter)
Me.EnsureChildControls()
Me.Render(render)
End Sub
Private listBox As Anthem.ListBox
Private btUp As Anthem.Button
Private btDown As Anthem.Button

End Class

End Namespace
And using it in aspx :

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
<%@ Register TagPrefix="webCtrl" Namespace="WebContr.WebControls"
Assembly="WebContr.WebControls" %>

<html>
<head>
</head>
<body>
<webCtrl:DynamicList runat="server" Width="300" Height="300"
ID="dynList" Visible="true"></webCtrl:DynamicList>
</body>
</html>
But site is blank, what i'm doing wrong? thanks for answers

Regards
Sep 24 '06 #1
2 2297
On Sun, 24 Sep 2006 13:10:19 +0200, "tepesco" <te*****@gazeta.pl>
wrote:
>Hi..

I'm trying to create small custom control.. class definition in vb looks
like:

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Resources
Imports System.ComponentMode
Imports Anthem

Namespace WebContr.WebControls

Public Class DynamicList
Inherits System.Web.UI.WebControls.WebControl
Implements INamingContainer

Protected Overloads Sub CreateChildControls()
Me.Controls.Clear()
Me.InitializeComponent()
End Sub

''' <summary>
''' Initializes the contained controls
''' </summary>
Private Sub InitializeComponent()

listBox = New Anthem.ListBox()
btUp = New Anthem.Button
btDown = New Anthem.Button

Me.btDown.Text = "Down"
Me.btUp.Text = "Up"

listBox.Visible = True
btUp.Visible = True
btDown.Visible = True

Me.Controls.Add(listBox)
Me.Controls.Add(btUp)
Me.Controls.Add(btDown)

End Sub

Protected Overloads Sub Render(ByVal render As HtmlTextWriter)
Me.EnsureChildControls()
Me.Render(render)
End Sub

Private listBox As Anthem.ListBox
Private btUp As Anthem.Button
Private btDown As Anthem.Button

End Class

End Namespace
And using it in aspx :
-snip-
>
But site is blank, what i'm doing wrong? thanks for answers
Might I suggest deriving your contol from the CompositeControl type, I
believe it is more suitable for your needs. This link
http://msdn2.microsoft.com/en-us/library/3257x3ea.aspx
provides a very good example.

The answer to your question is the DynamicList type never gets
rendered. Excluding the call to EnsureChildControls the type's Render
method seems to do nothing but call itself. Review the Render
implementation on the linked page

regards
A.G.
>Regards
Sep 24 '06 #2
Hi
Might I suggest deriving your contol from the CompositeControl type, I
believe it is more suitable for your needs. This link
http://msdn2.microsoft.com/en-us/library/3257x3ea.aspx
provides a very good example.

The answer to your question is the DynamicList type never gets
rendered. Excluding the call to EnsureChildControls the type's Render
method seems to do nothing but call itself. Review the Render
implementation on the linked page

regards
A.G.
Thanks! Now works... Really big thanks

Regards
Sep 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Tinus | last post by:
Hello all, I've created a custom control that draws a monthly schedule (using the Draw function in C#). Basically it draws 31 boxes and writes the day number in every box. This works...
3
by: Lloyd Sheen | last post by:
I have a piece of functionallity that is replicated on several pages. This would be a good candidate for a custom control right? Well I found a couple of tutorials (none really helpful) so I...
1
by: Elie Medeiros via .NET 247 | last post by:
Hi there, I have written a custom validator function to validate a datefrom a user-filled field. The function tries to parse the dateand if it can't, sets (serverValidateEventArgs)e.IsValid...
9
by: PJ6 | last post by:
I'm sure it's some attribute I have to set but I can't find it. I'd like to be able to have my properties in my custom web user controls show up in the web forms designer. Is that possible? Paul
6
by: Steve Amey | last post by:
Hi all I want to be able to throw a custom error up the call stack. I have looked around and it seems as though it's possible, but I can't get it to work :o( Below is some sample code. ...
8
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
1
by: JTC^..^ | last post by:
When I create a custom control inside my Windows Application project it does not appear in the toolbox. I'm using Visual Studio 2005 (Team System for Developers), so this should appear...
4
by: Rex the Strange | last post by:
Hello all, Can anyone please tell me why I can't do this (and what I can do to get the equivalent effect): In the code: public enum myenum value1 value2
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.