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:
01374414
Views:
12
>I have several user controls (.ASCX) that exist on a page.
>
>In each, when an event happens (sqldatasource.inserted), I need to refresh the data in a control on the main (parent) page.
>
>Thinking in terms of programming practices commonly available for the last 20 years, I thought I could just get a reference to the page (the containing object) and call the method I need. Yeah. Right.
>
>Google searches indicate that that obviously is too simple (you can't do things easily in .NET of course), and I have to write a pile of code somewhere to (re)define my page class or something to that effect.
>
>Can someone explain this to me in some rational terms please?
>
>This is in VS2005 in VB.

Events, as Naomi suggers, are probably best.
But as an alternative you could define the methods that you will be calling in an interface and have the relevant pages implement the interface. You can then cast the usercontrol's page property to the interface and call the method.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform