954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Parent user control method needs to be accessed from child user control

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

t2009
Newbie Poster
3 posts since Aug 2009
Reputation Points: 10
Solved Threads: 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.

sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
 
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
---  <strong>DisplayApprovalChainList(dsAL)</strong>

End Sub


Thanks,

t2009
Newbie Poster
3 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You