Can I read code-behind info outside of asp.net?

  • Thread starter Thread starter Jim Bancroft
  • Start date Start date
J

Jim Bancroft

Hi everyone,

I have an ASP.Net page that uses various DataGrids and other ASP controls.
Right now I'm manipulating them in my code-behind file, but I'd like to use
my business-logic dlls for that stuff instead. Is there a way (a context
wrapper of some sort, maybe?) to gain access to these controls from external
class libraries besides passing them in through method arguments?

Thanks,
Jim
 
I don't think there's a way to get a reference to the page from business
objects. Frankly, I'm not sure why you'd want to...doesn't seem NTier-ish.
Your business layer should be generic regardless of which presentation layer
is being used. For example, your business layer should be able to server a
webservice...if you start to manipulate/deal with System.Web.UI classes in
it however, I'm not sure how that's doable. You haven't explained what it
is you are doing, but they seem like presentation logic layer stuff, which
should remain in your codebehind file.

Karl
 
Hi Karl,

You're quite right; it's not a good way to design things initially...however
I'm involved with a port of an existing ASP app, which used the object
context to grab HTML form elements in the middle-tier, and they want to keep
the designs as similar as possible. Aesthetics aside, would anyone know of
a way to get at the code-behind info in an outside class library?
 
Instead of passing multiple parameters, you could simply page in the Page
which would then allow you to find it's child controls (either via
FindControl, or better by exposing them as properties of your page).

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Jim Bancroft said:
Hi Karl,

You're quite right; it's not a good way to design things initially...however
I'm involved with a port of an existing ASP app, which used the object
context to grab HTML form elements in the middle-tier, and they want to keep
the designs as similar as possible. Aesthetics aside, would anyone know of
a way to get at the code-behind info in an outside class library?
 
Back
Top