9 Years
Discussion Span
Last Post by t2009

Post your code and explain what you mean. By child do you mean it descends from, or it contains another user control plus more controls? Either way the user control is a strongly typed class so just add public methods.


Parent user control method needs to be accessed from child user control. Any solutions???

In the parent user control file .ascx as listed below..

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ApprovalRoute.ascx.vb" Inherits="UserControls_ApprovalRoute" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Register Src="~/UserControls/ApprovalRouteG.ascx" TagName="AprvlRouteG" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/ApprovalRouteKA.ascx" TagName="AprvlRouteKA" TagPrefix="uc2" %>

                <td colspan="3" bgcolor="White" 
                    style="padding: 10px; border: 1px solid #000000; height: auto;">
                    <asp:Label ID="lblApprovers" runat="server" Font-Bold="True" ForeColor="#336600" />
                    <asp:DataList ID="dlApprovalChain" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                            <asp:Label ID="lblApprover" runat="server" 
                                Text='<%# Eval("LocationOwnerName") %>' BorderStyle="None"  
                                style="text-align: center" CssClass="LblStyle"></asp:Label>
                            <cc1:DropShadowExtender ID="lblApprover_DropShadowExtender" runat="server" 
                                Enabled="True" Radius="3" Rounded="True" TargetControlID="lblApprover" 
                                Width="2" TrackPosition="True">
                            &nbsp;<asp:Image ID="imgArrow" runat="server" ImageAlign="Middle" 
                                    Visible='<%# Eval("LocationName").substring(0,6).tolower() <> "system" %>' />
                    <asp:Label ID="lblNoRecords" runat="server" Text="No Approval Route Found"></asp:Label>


In the parent user control .ascx.vb file the function is as listed below:

Sub DisplayApprovalChainList(ByVal dsALTmp As WFInterfaceWS.dsStepLocation_v2)
        lblApprovers.Visible = False
        lblNoRecords.Visible = False
        dlApprovalChain.Visible = True
        dlApprovalChain.DataSource = dsALTmp
    End Sub

In the child user control .ascx.vb file the function with in the parent user control i.e., DisplayApprovalChainList(ByVal....) needs to be accessed with in the function as listed below..

Private Sub ShowApprovalChainControl()
            Dim dsAL As WFInterfaceWS.dsStepLocation_v2

            dsAL = Me.dsApproverChain
---  [B]DisplayApprovalChainList(dsAL)[/B]

End Sub


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.