Hi, I am currently working on a number of various custom datasource controls. I've found the solution for most problems on the way so far, but now I really got stuck. One of my controls will take a set of various input parameters, similar to the good old SQLDataSource control. One of my parameter classes is supposed to take a value from an arbitrary control on the page. Howevere, it does not seem to be an easy way to access the Page property (from inside this control) on my DataSource control. I need this to use FindControl. When I do so, from inside my "ExternalDataSource" control, the Mybase.Page property is null. BUT, if I access the Control's page property, which is indeed the very same propery, from the aspx page, it all works. To cxlearify this, look at the bold/underlined section in the code behind. If i remove this part it all works from outside the class. Otherwise it fails.
What Ive come up with so far is this:
My custom control have a collection of parameters, the ParamCollection which holds a set of objects that inherits from my custom parameter base class "ExternalParameterBase".
Now, one of these objects is the ExternalControlParameter declared as follows on the aspx page.
<asp:ExternalControlParameter Name="paramname1" ControlID="Textbox1" />
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class ExternalDataSource
Public Property InputParams As ParamCollection......
Protected Overrides Function GetView(viewName As String) As DataSourceView.......
Protected Overrides Function GetViewNames() As ICollection.........
Public Overrides Property Page() as System.Web.UI.Page
If not mybase.page is nothing then
Im not sure if I explained good enough. Anyway, Im greatful for all help on this!