• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 574
  • Last Modified:

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 .
0
nagdotnet
Asked:
nagdotnet
  • 2
1 Solution
 
tetorvikCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now