views:

18

answers:

0

I'm trying to update the visibility of a parent control based on an event in this same parent's child control.

It is a large pre-existing project and I'm trying to add some basic logic to simplify a checkout process. The problem I'm having is that it has so many control (which is a good thing) that due to it's structure I'm not sure how to make the children communicate nicely with their parents.

For example.... here is the parent.

    <div class="checkout-page">
    <nopCommerce:OrderProgress ID="OrderProgressControl" runat="server" OrderProgressStep="Address" />
    <div class="clear">
    </div>
    <div class="page-title">
        <h1><%=GetLocaleResourceString("Checkout.ShippingAddress")%></h1>
    </div>
    <div class="clear">
    </div>
    <nopCommerce:CheckoutShippingAddress ID="ctrlCheckoutShippingAddress" runat="server" />
    <div class="clear">
    </div>

    <div class="order-summary-title">

    </div>
    <div class="clear">
    </div>
    <div class="order-summary-body" style="display: none;">
        <%-- <nopCommerce:OrderSummary ID="OrderSummaryControl" runat="server" IsShoppingCart="false" /> --%>
        <nopCommerce:OrderSummaryModifyShipping ID="OrderSummaryModifyShippingControl" runat="server" IsShoppingCart="false" IsEditable="true"/>
    </div>

and here is the child, how can I show/hide elements of the parent based on a button press from the child?

<div class="checkout-data">
<asp:Panel runat="server" ID="pnlSelectShippingAddress" Visible="false">
    <div class="select-address-title">
        <%=GetLocaleResourceString("Checkout.SelectShippingAddress")%>
    </div>
    <div class="clear">
    </div>
    <div class="address-grid">
        <asp:DataList ID="dlShippingAddresses" runat="server" RepeatColumns="4" RepeatDirection="Horizontal"
            RepeatLayout="Table" ItemStyle-CssClass="item-box" >
            <ItemTemplate>
                <div class="address-item">
                    <div class="select-button">
                        <asp:Button runat="server" CommandName="Select" ID="btnSelect" Text='<%#GetLocaleResourceString("Checkout.ShipToThisAddress")%>'
                            OnCommand="btnSelect_Command" ValidationGroup="SelectShippingAddress" CommandArgument='<%# Eval("AddressId") %>'
                            CssClass="selectshippingaddressbutton" />
                    </div>
                    <div class="address-box">
                        <nopCommerce:AddressDisplay ID="adAddress" runat="server" Address='<%# Container.DataItem %>'
                            ShowDeleteButton="false" ShowEditButton="false"></nopCommerce:AddressDisplay>
                    </div>
                </div>
            </ItemTemplate>
        </asp:DataList>
    </div>
</asp:Panel>
<div class="clear">
</div>


<div id="inline1">  
    <div class="enter-address-title">
        <asp:Label runat="server" ID="lEnterShippingAddress"></asp:Label>
    </div>
    <div class="clear">
    </div>
    <div class="enter-address">
        <div class="enter-address-body">
            <nopCommerce:AddressEdit ID="ctrlShippingAddress" runat="server" IsNew="true" IsBillingAddress="false"
                ValidationGroup="EnterShippingAddress" />
        </div>
        <div class="clear">
        </div>
        <div class="button">
            <asp:Button runat="server" ID="btnNextStep" Text="Add Address"
                OnClick="btnNextStep_Click" CssClass="newaddressnextstepbutton" ValidationGroup="EnterShippingAddress" />
        </div>
    </div>
    <div class="button">
        <asp:Button ID="proceedToBillingAddressBtn" OnClick="btnProceedBillAddr_Click" 
            runat="server" Text="Continue" CssClass="checkoutbutton" />
    </div>
</div>

Any help would be awesome. Thanks - Ryan