簡體   English   中英

當控件位於內容頁面上的更新面板中時,更新母版頁

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

我有一個應用程序,該應用程序在更新面板中具有控件,但是需要更新母版頁面的一部分-我不確定是否可以這樣做?

 <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包裝標簽

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM