Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User control call page method?
Message
 
 
À
16/01/2009 12:47:21
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01374382
Message ID:
01374416
Vues:
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.

Interesting idea.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform