I have an ASPX page and I need to interact with the controls on this page
from another class that is not my code-behind class.  I cannot figure out
how to do this without creating a property to read when the class returns
from the code-behind class.  What I would like to know is how I can
reference the controls on the ASPX page in this 2nd class but without having
to create properties.

ASPX Page
     \
   Code Behind Class
       \         \
     Class1    Class2

The code behind class might have code that looks this...

        dim c1 as new class1
        dim c2 as new class2

        if bl then
                c1.execute()
        else
                c2.execute()
        end if

The class code might look something like this...

Class1
public function execute()
        Textbox1.Visible = True
        Textbox2.Visible = True
        Textbox3.Visible = False
        Textbox4.Visible = False
end function

Class2
public function execute()
        Textbox1.Visible = False
        Textbox2.Visible = False
        Textbox3.Visible = True
        Textbox4.Visible = True
end function

What is unique is that I cannot easily move the functions in class1 and
class2 into the code-behind class.  So I am trying to figure out if I can do
something to give this sub-class access to the controls code-behind class.
I know that I can modify the declarations of the controls from "protected"
to "public" to gain access, but how to I reference them in the sub-class if
I do this?

If I cannot do this, the only option that I can see is to merge the
code-behind class and the sub-class.  I can do that, but it will be a
significantly painfully process.  I am trying to avoid this if I can.

Any suggestions, ideas, samples, references, links, etc. would be very much
appreciated.  It seems like this would be a simple matter of having the
sub-class inherit the code-behind class, but I cannot see the answer or
figure out how to set up the code.

Best regards,
Jon

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to