calling user control method from parent page

May i  know how to call a public method of user control from aspx code behind using vb.net please .
nagdotnetAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
tetorvikConnect With a Mentor Commented:
See below, hope it helps.
User Control declaration on parent page:
    <form id="form1" runat="server">
    <div>
        <uc1:MyUserControl ID="MyUserControl1" runat="server" />
    </div>
    </form>
 
Public Function in MyUserControl.ascx.cs:
    Public Function MyFunction() As Boolean
        Return True
    End Function
 
Function call from parent page:
MyUserControl1.MyFunction()

Open in new window

0
 
nagdotnetAuthor Commented:
i  have only
<%@ Register Src="~/LinkPager.ascx" TagName="LinkPager" TagPrefix="custom" %>
in my aspx page , but i added now
<uc1:LinkPager ID="LinkPager1" runat="server" />

But i am getting compile error "Unknown server Tag uc1:LinkPager"
0
 
tetorvikCommented:
use
<custom:LinkPager ID="LinkPager1" runat="server"/>

as you use "custom" as a TagPrefix
0
All Courses

From novice to tech pro — start learning today.