473,399 Members | 3,919 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,399 software developers and data experts.

Loadcontrol with parameters

Hi

I'm having this major issue loading a usercontrol at runtime using the
overload on Loadcontrol(type,object). Here's the code in the aspx
code-behind file

Dim myControl As New Control
Dim strCtlPath As String = "~/includes/pinned/NewConsumerReviews.ascx"
Dim objParams(0) As Object
objParams(0) = 1
myControl = LoadControl(strCtlPath)
PlaceHolder1.Controls.Add(LoadControl(myControl.Ge tType, objParams))

and the user control constructors look like this:

Partial Class Includes_Pinned_NewConsumerReviews
Inherits System.Web.UI.UserControl
Sub New()
MyBase.New()
End Sub
Sub New(ByVal x As Integer)
MyBase.New()
End Sub
<FUNCTIONS>
End Class
The error i'm getting is:

Server Error in '/www.compare-online.co.uk' Application.
Constructor on type 'ASP.includes_pinned_newconsumerreviews_ascx' not found.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Constructor on type
'ASP.includes_pinned_newconsumerreviews_ascx' not found.

Source Error:

Line 69:
Line 70: myControl = LoadControl(strCtlPath)
Line 71: PlaceHolder1.Controls.Add(LoadControl(myControl.Ge tType,
objParams))
Line 72:
Line 73:
Source File: C:\Solutions\Compare
Online\CompareOnline.Web\compare-online.co.uk\MasterPages\1\Base.master.vb
Line: 71

Stack Trace:

[MissingMethodException: Constructor on type
'ASP.includes_pinned_newconsumerreviews_ascx' not found.]
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
+1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) +114
System.Web.UI.TemplateControl.LoadControl(IWebObje ctFactory
objectFactory, VirtualPath virtualPath, Type t, Object[] parameters) +329
System.Web.UI.TemplateControl.LoadControl(Type t, Object[] parameters)
+13
MasterPages_1_Base.SetPinnedContent() in C:\Solutions\Compare
Online\CompareOnline.Web\compare-online.co.uk\MasterPages\1\Base.master.vb:71
MasterPages_1_Base.Page_Load(Object sender, EventArgs e) in
C:\Solutions\Compare
Online\CompareOnline.Web\compare-online.co.uk\MasterPages\1\Base.master.vb:20
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
Thanks for any help
Carl
Sep 7 '06 #1
0 3760

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

Similar topics

0
by: George Durzi | last post by:
I have a C# in my web application called BasePage. It inherits from System.Web.UI.Page. I'm using page inheritance in my web app so all my pages have an identical look and feel by inheriting from...
3
by: Robert Walter | last post by:
I want to user the Page method LoadControl inside the Global.asax.cs but when I instantiate a page and try it I get the following error... System.NullReferenceException: Object reference not set...
10
by: Umut Tezduyar | last post by:
It seems, it is caching it. The following code is an example for it. How can avoid from this. override void OnLoad (sender and eventargs) { Control control = this.LoadControl (path);...
8
by: Sam Kuehn | last post by:
How do I accomplish the fallowing (is it even possible). Say I write a UserControl "MyControl.ascx". Now I use LoadControl("MyControl.ascx"). But I really want MyControl to require parameters in...
2
by: Keith Patrick | last post by:
Maybe my expectations are just too low because I haven't read much documentation on this method, but basically, I am trying to load a user control dynamically without using a virtual path (I have...
1
by: Joe | last post by:
Hello All, I have a class that inherits from System.Web.UI.Page. In it I call the Page.LoadControl. I am having trouble with the virtual path that the LoadControl method accepts as its...
0
by: MattB | last post by:
I'm making a reusable class to load and populate user controls based on database values. I had the basic code working from codebehind, and now I'm moving it to a reusable class. Once in the...
1
by: Andreas | last post by:
Hallo zusammen, ich kämpfe seit Tagen mit folgendem Problem und habe bisher leider keine Lösung gefunden. Vielleicht kann mir jemand helfen: Ich möchte auf einer Seite (test.aspx) ein...
0
by: =?Utf-8?B?U0VHQUNP?= | last post by:
Hi, someone knows about an example of the method LoadControl(Type, Object), I search everything in the web but I don't find it and if someone can tell me about the implementation of the constructor...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...

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.