当控件位于内容页上的更新面板中时,更新母版页

本文关键字:更新 母版页 控件 于内容 | 更新日期: 2023-09-27 18:15:04

我有一个应用程序,其中有一个更新面板内的控制,但需要更新母版页的一部分,以及-我不确定这是否可以做到?

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

在母版页内我想更新的母版页部分如下:

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

背后的代码:

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

lblMonthlyPayment需要根据用户在内容页面上选择的内容进行更改,但由于控件位于更新面板中,因此无法工作。

内容页面:

 <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);
        }

当控件位于内容页上的更新面板中时,更新母版页

用UpdateMode="Always"的UpdatePanel来包装标签