2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by t2009
0

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.

0

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" %>


 <tr>
                <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">
                        <ItemTemplate>
                            <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">
                            </cc1:DropShadowExtender>
                            &nbsp;<asp:Image ID="imgArrow" runat="server" ImageAlign="Middle" 
                                    ImageUrl="~/Images/GreenRightArrow.gif" 
                                    Visible='<%# Eval("LocationName").substring(0,6).tolower() <> "system" %>' />
                        </ItemTemplate>
                    </asp:DataList>
                    <asp:Label ID="lblNoRecords" runat="server" Text="No Approval Route Found"></asp:Label>
                </td>
            </tr>
        </table>

---

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
        dlApprovalChain.DataBind()
    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()
        Try
            Dim dsAL As WFInterfaceWS.dsStepLocation_v2

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

End Sub

Thanks,

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.