Search code examples
asp.netajaxascx

.aspx works but .ascx does not... why and how to fix?


I want to put a ASTreeView web control in a custom web control, ASTreeView sample code is like:

<ct:ASTreeView ID="astvMyTree" 
                    runat="server"
                    ...
                    LoadNodesProvider="~/ASTreeViewDemo5.aspx"

                    .../>

LoadNodesProvider is the page ajax called when loading a node...however if I changed the provider to my .ascx file, it does not work:

LoadNodesProvider="~/ASTreeViewDemo5.ascx"

it did not even go through the Page_Load part of the .ascx file Though this might be related with astreeview itself, I'm wondering what the problem could be? anything I can do to fix it? Thanks!


Solution

  • It is because ascx must have a container ie Page. You can't use it same way as Page.