There are many ways to exchange data between webpage (.aspx) and it’ s user control (.ascx). You can declare properties on usercontrol, you can raise events on usercontrol catch them on webpage with delegates, or use javascript for data exchange and so on.. Few days ago my buddy and me came up with an alterative solution , using an interface class.
Here’s how:
We will build a small web project that uses usercontrol to add two numbers and show the result. These two numbers come from the parent page (.aspx), through specific interface.
1. For this example, create a new ASP.NET Web application project on Visual Studio.
2. On Default.aspx page, add two labels and textboxes (“txtNumber1″ and “txtNumber2″. Your page should look like this:













