2011-11-17 58 views
0

我有一個應用程序在更新面板中有一個控件,但需要更新母版頁的一部分aswel - 我不確定這是否可以做了什麼?當控件位於內容頁面的更新面板中時更新主頁面

<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需要根據用戶在內容頁面上選擇的內容進行更改,但a該控件位於更新面板內,它不起作用。

內容頁:

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

     } 

在此先感謝...

回答

0

裹帶的UpdateMode在UpdatePanel標籤= 「始終」

+0

是,母版頁上的lblMonthlyPayment是什麼樣的? – anna

+0

是的,它應該可以工作 –

+0

我已經嘗試過使用這幾種不同的方式,但它似乎沒有做到這一點 - 主頁面板仍然不更新。 – anna