473,463 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem dynamically adding Custom Web Control.

Hi,
I can't seem to get my control to render properly. When I just placed
it on the page it was working fine...and the RenderContents sub is
getting fired...I'm guessing it's just too late???

The HoverMenuExtender renders, the PopPanel renders, and the Literal
(Hello World) renders on the page. But my MiniExhibitPopup does not.

Here's the pertinent code:

Partial Public Class _Default
Inherits System.Web.UI.Page

Protected Overrides Sub CreateChildControls()

For i As Integer = 1 To 10
Dim Panel As System.Web.UI.WebControls.Panel =
CType(Page.FindControl("ME" + i.ToString),
System.Web.UI.WebControls.Panel)

Dim PopPanel As New System.Web.UI.WebControls.Panel
With PopPanel
.ID = "PopupMenu" + i.ToString
.CssClass = "MiniExhibitPopup"
.Controls.Add(New MiniExhibitPopup)
.Controls.Add(New LiteralControl("Hello World!"))
End With
Page.Form.Controls.Add(PopPanel)

Dim HoverMenuExtender As New
AjaxControlToolkit.HoverMenuExtender
With HoverMenuExtender
.ID = "h" + Panel.ID
.PopupControlID = PopPanel.ID
.PopupPosition =
AjaxControlToolkit.HoverMenuPopupPosition.Center
.TargetControlID = Panel.ID
.PopDelay = 500
End With
Page.Form.Controls.Add(HoverMenuExtender)
Next
End Sub
End Class
Public Class MiniExhibitPopup
Inherits WebControl

Protected Overrides Sub RenderContents(ByVal writer As
HtmlTextWriter)
Dim html As String
Dim objReader As IO.StreamReader

Try
objReader = New StreamReader(Context.Server.MapPath("~/
Controls/MiniExhibitPopup/MiniExhibitPopup.htm"))
html = objReader.ReadToEnd()
objReader.Close()
Catch Ex As Exception
Throw Ex
End Try

html = html.Replace("##EXHIBITNAME##", "The Chadwikiti Hut")
html = html.Replace("##USERNAME##", "Chad Hurd")
html = html.Replace("##DESCRIPTION##", "Lorum Ipsum Lorum
Ipsum Lorum Ipsum Lorum Ipsum Lorum Ipsum Lorum Ipsum Lorum Ipsum
Lorum Ipsum ")
html = html.Replace("##ATTENDEES##", "0")
html = html.Replace("##USERIMAGE##", "/Images/face.jpg")

writer.Write(html)
End Sub
End Class

Please help. Thanks,

Chad.

May 17 '07 #1
0 1210

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

Similar topics

2
by: anand | last post by:
Hi all, I have created a custom control which displays Image using Graphics.. I am using this control in a different windows application. I am dynamically creating the control and putting that...
3
by: Eric | last post by:
I have built a composite user web control that I want to create dynamically. The form will contain a variable number of these controls and as well some of the contents of the user web control...
3
by: David Freeman | last post by:
Hi There! I'm having trouble dynamically adding custom controls. My custom controls does not use code-behind but only <script /> block for programming. So as a result, I don't need to compile my...
2
by: Web Team | last post by:
Hi All, I'm in the process of writing a eich text editor web custom control. The actual text/HTML is displayed/editied in a DIV layer, which I have created like this: output.Write("<span...
7
by: Dino Buljubasic | last post by:
Hi, I am using C# 2.0 (VS2005) to build my user control that contains a number of dynamically loaded ListViews. ListViewItems have their ForeColor properties set to either black or blue to...
2
by: Jarod | last post by:
Hey I change backColor of linkButton in my Page_Load: lbDoSth.BackColor = Color.Red; But I have multiView on this page. On one of the views I have detailsView. When I add a new row a set...
12
by: Ron M. Newman | last post by:
Hi, I can load an assembly using the Assembly.Load(....) However, I'd like dynamic loading of assemblies to be identical to putting an assembly reference in your VS2005 project. and yes, I...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
5
by: Nathan Sokalski | last post by:
I have a custom control that I wrote (I inherit from System.Web.UI.WebControls.CompositeControl). I dynamically add this control to my Page, but I was told that dynamically added controls do not...
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.