473,473 Members | 2,274 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.

ps If this is a duplicate post I apologize, as I have waited 30
minutes and not seen this displayed.

May 17 '07 #1
0 726

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...
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...
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...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
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.