简体   繁体   中英

Updating the master page when the control is within an update panel on the content page

I have an application which has a control within a update panel but needs to update a part of the master page aswel - im not sure if this can be done?

The

 <asp:ScriptManager ID="ScriptManager" runat="server" />

is within the master page and the part of the master page i want to update is the following:

<div id="divPanelMyCover" class="divPanelMyCover" runat="server">
                                <div class="sectionYourProtection">
                                    <div class="sectionPadding">
                                        <h4>Title</h4>
                                    </div>
                                    <div class="innerPanelMyCover">
                                        <br/>
                                        <ul class="bulletList" type="square">
                                            <li><span class="spBold">Monthly Payment: </span><asp:Label ID="lblMonthlyPayment" runat="server" Text=""></asp:Label                                                                                        </div>
   </div>
 </div> 

code behind:

 lblMonthlyPayment.Text = Convert.ToString(application.Premium);

The lblMonthlyPayment needs to change depending on what the user selects on a content page but as the control is within an update panel it is not working.

Content page:

 <asp:UpdatePanel ID="upUpSell" runat="server">
             <ContentTemplate>  
<div id ="divSlider" runat="server" visible="false">
                        <br />
                        <h3>If you want, you can change the amount ... </h3>
                                                    <hr />
                        <div class="sliderContainer"> 
                           <telerik:RadSlider id ="rdSlider" AutoPostBack="true" runat="server" Orientation="Horizontal" Width="450"
                                        Height="70" MinimumValue="0" MaximumValue="50" LargeChange="10" TrackPosition="BottomRight"
                                        ItemType="Tick" IsSelectionRangeEnabled="false" SelectionStart="10" SelectionEnd="30" Skin="Default" DragText="Select Premium" >

                            </telerik:RadSlider>
                        </div>
                        <asp:Label ID="lblValue" runat="server" Text="" Visible="false"></asp:Label>
                    </div>                   

c#

protected void Page_Load(object sender, EventArgs e)
    {
        //if (!Page.IsPostBack)

         //Pre-populate the screen with data from ApplicationBO
        ApplicationBO application = (ApplicationBO)Session["Application"];

        if (!Page.IsPostBack)
        {
            if (Session["Application"] == null)
                application = new ApplicationBO();
            else
                application = (ApplicationBO)Session["Application"];
            lblclientName.Text = application.FirstName;
            rdSlider.Value = Convert.ToDecimal(application.Premium);
            lblMonthlyPayment.Text = Convert.ToString(application.Premium);
        }

        divSlider.Visible = true;

        string upsellValue = Convert.ToString(application.Premium);

        if (divSlider.Visible == true)
        {
            upsellValue = Convert.ToString(rdSlider.Value);

            // Save the current page information
            application.Premium = Convert.ToDecimal(upsellValue);

        }

Thanks in advance...

用带有UpdateMode =“ Always”的UpdatePanel包装标签

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM