Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I'm using a usercontrol uc.ascx. I have added the usercontrol to page Default.aspx. I want to call a function of the page Default.aspx in the usercontrol.

Is it possible, if any one knows please help..

Thanks

Nidhin
Posted

The best way to do this is to hook up a delegate between the control and hte page, so that the control can send a message to the page. A more hard coded approach, where the control needs to know the specifics of the page that contains it, is a sign that your page design is broken, and your control is not really worth writing as a control, it should just live in the page, or be better engineered.
 
Share this answer
 
For that, one way is create an abstract class in app_code folder, which must have an abstract method.Inherit your page by this class and override the method.This method you can access in usercontrol.

For example , have a look to the Link
 
Share this answer
 
Please don't push 'answer' to ask another question.

Here's a lesson[^] in what programmers do in a situation like this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900