Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User control call page method?
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
Miscellaneous
Thread ID:
01374382
Message ID:
01374524
Views:
18
ALMOST!

I've created the interface class..

Namespace FacilitiesManagement.Interfaces

Public Interface IMyWebPage

Sub BuildLocationTree()

Sub RefreshLocationTree()

End Interface
End Namespace

I've set my Default.aspx to implement FacilitiesManagement.Interfaces.IMyWebPage and added the Implements FacilitiesManagement.Interfaces.IMyWebPage.BuildLocationTree/RefreshLocationTree to the appropriate Sub declarations.

I can declare the interface in my ASCX control

Dim ThePage As FacilitiesManagement.Interfaces.IMyWebPage

But this does not actually give me access to the page. ThePage is still Nothing. Somehow I have to instantiate it so it references my page?





>>
>>First of all, thanks for your help!
>>
>>Problem with trying your interface approach is that it appears that (looking at your example) I still have to inherit my _Default page when declaring the interface (same problem).
>
>Try this:
>
>If you don't have an App_Code folder already, right-click on the project and select Add ASP.NET Folder, then App_Code. Right-click on App_Code and create a new class. Let's call it Interfaces. Modify the class to include a namespace and turn it into an interface definition, ex:
>
>
>namespace MyApp.Interfaces
>{
>    public interface IMyWebPage
>    {
>        void UpdateText(string newText);
>    }
>}
>
>
>
>Namespace MyApp.Interfaces
>   Public Interface IMyWebPage
>      Sub UpdateText(ByVal newText As String)
>   End Interface
>End Namespace
>
>
>Now go back to your user control - you should be able to type: MyApp.Interfaces and see Intellisense pop-up for the IMyWebPage interface.
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform