Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Referencing Controls in .net 2.0 . works in 1.1

Status
Not open for further replies.

autumnEND

Programmer
Nov 1, 2005
61
GB
Hi, i am having a few problems migrating my app from .net 1.1 to 2.0.

i have 2 user controls (ascx) and im trying to call a function from one of the controls.

in 1.1 this is how i reference the other control

templates.maintenance.ucExpandTree UcExpandTree = (templates.maintenance.ucExpandTree) LoadControl(ResolveUrl("../maintenance/ucExpandTree.ascx"));

once declared i call a function in the other page
which passes a data row to the function

UcExpandTree.drawRows(dr);//calls the other user control

//the code in the other usercontrol
public void drawRows(System.Data.DataRow dr)
{
// do something
}

this works fine in .net 1.1 but when i try and add it to 2.0 it wont let me reference the drawRows function.

maybe there is a simple solution to this, any help would be greatly appreciated . as its driving me insane.

thanks in advance
 
The new default build model in ASP.NET 2.0 is the problem.

Everything is generated dynamically so you can't reference a local user control type in the manner you could with 1.x.

The options for solutions are:

1. Use a <%@ Register %> directive in your page to register the User Control type you want to work with (this assumes you know the type of control you want to work with beforehand).

2. Install Visual Studio 2005 SP1: ...which gives you a new type of project that is similar to the old website build model.

3. Install the Web Application Projects plug-in to have get a new project type like you did in option 2, but without all of the extra stuff SP1 fixes:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top