PC Review


Reply
Thread Tools Rate Thread

Control. What am I doing wrong?

 
 
shapper
Guest
Posts: n/a
 
      26th May 2007
Hello,

I am creating a class with a control. I compiled the class and used it
on an Asp.Net 2.0 web site page.
I can see the begin and end tags of my control (<ol> and </ol>) but
somehow the child controls (just a literal for testing) of my control
is not being added to the page.

Could someone tell me what am I doing wrong?

' List
<DefaultProperty("ID"), ToolboxData("<{0}:List runat=server></
{0}:List>")> _
Public Class List
Inherits WebControl
Implements INamingContainer

Public Sub New()
End Sub ' New


Protected Overrides Sub CreateChildControls()

Dim l As New Literal
l.Text = "<li>" & Me.Items.Count & "</li>"
MyBase.Controls.Add(l)

' Create child controls
MyBase.CreateChildControls()
Me.ChildControlsCreated = True

End Sub ' CreateChildControls

' RenderBeginTag
Public Overloads Overrides Sub RenderBeginTag(ByVal writer As
HtmlTextWriter)

' Add control attributes
With writer
If Not String.IsNullOrEmpty(Me.ID)
Then .AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID)
If Not String.IsNullOrEmpty(Me.CssClass)
Then .AddAttribute(HtmlTextWriterAttribute.Class, Me.CssClass)
End With ' writer

' Render begin tag
writer.RenderBeginTag(HtmlTextWriterTag.Ol)

End Sub ' RenderBeginTag

' RenderEndTag
Public Overloads Overrides Sub RenderEndTag(ByVal writer As
HtmlTextWriter)

' Render end tag
writer.RenderEndTag()

End Sub ' RenderEndTag

End Class ' List

Could someone tell me what am I doing wrong?

Thanks,
Miguel

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add control do page. What is going wrong here? shapper Microsoft ASP .NET 1 7th Nov 2006 04:15 PM
Wrong control getting selected... Mark Microsoft VB .NET 0 15th May 2006 03:10 PM
What's wrong with this control source ? =?Utf-8?B?RGF2aWQ=?= Microsoft Access Reports 1 4th Jun 2004 03:37 AM
Web Control - and now i know it's not something i'm doing wrong.... Adam Maltby Microsoft VB .NET 4 12th Mar 2004 04:57 PM
What's wrong with this reference to a control? Karen Microsoft Access Form Coding 5 19th Nov 2003 07:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:28 AM.