Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 2nd, 2006, 02: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, 06:38 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 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, 02: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...
 


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 04:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.