Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 2nd, 2006, 01:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default Dynamic Usercontrol Issue

I am migrating a site to 2.0 from 1.1. In the old pages I have a usercontrol that I load dynamically but I am getting an error:

"Type 'recnav' is not defined"

in my Declaration:

Protected RecNav As recnav

Where recnav is my usercontrol saved as recnav.ascx.

This worked before...is there something I have to do differently in 2.0?

-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
  #2 (permalink)  
Old June 2nd, 2006, 05:38 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Bean,

You need to add a reference to the markup of your page, so the code behind knows what control you're talking about. You can either set the Control property to the user control or the VirtualPath property. Here's a quick example:

<%@ Reference Control="~/Controls/AdminMenu.ascx" %>

Then in your code behind, you can new up an instance of AdminMenu (in this example)

Hope this helps,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
  #3 (permalink)  
Old June 5th, 2006, 01:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

Thanks yes that worked, I also declared the usercontrol like so:

Protected RecNav As ASP.MyControlName

-------------------------
Beware of programmers with screwdrivers...


Similar Threads
Thread Thread Starter Forum Replies Last Post
loaded usercontrol benordz C# 7 April 4th, 2008 09:16 AM
ObjectDataSource in UserControl Colonel Angus .NET Framework 2.0 0 April 3rd, 2008 10:14 AM
ArrayList with UserControl rhd110 General .NET 2 August 12th, 2007 12:29 PM
hi query on usercontrol? karthikc85 ASP.NET 2.0 Basics 0 October 14th, 2006 01:28 AM
dynamic excel and currency issue mussitsch Classic ASP Professional 0 March 14th, 2006 12:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.