2011-11-17 61 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