tags:

views:

337

answers:

3

SetFocus

I'm trying implement the above Se Focus code in a Class Library that i have. The class that I'm going to implement in is call HtmlHelper class but I can't seem to reference the System.Web.UI class in the Class Library project.

How do you reference the System.Web.UI in Class library project?

+2  A: 

You need to add a reference to the System.Web assembly (look in the .NET tab). That said, I looked at the linked code and you could pretty easily flip the function around a bit and just return a string and loose the dependency on System.Web.UI.Page. Which probably makes alot more sense in the long run.

Wyatt Barnett
yeah i think it might be to lose the dependency.
Jack
A: 

There aren't usually any technical reasons; perhaps if you are using something "new"... have you checked that the dll is targetting the correct version of the framework?

There are, however, good architectural reasons not to do so... it is generally a lot cleaner to abstract such things, so that code never calls "up" the stack... only down. Perhaps pass in an interface that exposes this (which the UI project implements).

Marc Gravell
A: 

Add a reference to the System.Web assembly.

Alan Jackson