2012-01-30 70 views
1

當用戶選擇DropDownList控件中的元素時,我必須更新我的Web部件(SharePoint2010)中的asp控件(標籤和表格)。我在DropDownList中添加了一個EventHandler來編輯標籤和表格的單元格。UpdatePanel中的內容未更新(在Web部件中)

我使用asp:UpdatePanel和asp:AsyncPostBackTrigger觸發器。

在VS2010中調試時,我可以看到服務器端方法被調用,標籤和表格單元格被更新。

但是,當返回AJAX調用時,Web部件中的控件不會更新。當我在FireBug控制檯中監視HTTP響應時,我可以看到服務器沒有返回更新後的控件值。

這裏是ASCX的代碼:

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" 
    OnSelectedIndexChanged="listBoxSelectedIndexChanged"> 
</asp:DropDownList> 

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
    <ContentTemplate> 
     <asp:Label ID="testlabel" runat="server">test</asp:Label> 
     <asp:Table ID="Table1" runat="server" Height="100px" Width="253px" 
      CellPadding="1" CellSpacing="1" CssClass="marcheFonds"> 
     </asp:Table> 

    </ContentTemplate> 

    <Triggers> 
     <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" /> 
    </Triggers> 
</asp:UpdatePanel> 

而在服務器側方法listBoxSelectedIndexChanged(局部類ListeUserControl:用戶控件),我這樣做:

Table1.Rows[i].Cells[j].Text = rate.month1; 
Table1.Rows[i].Cells[j].Text = rate.month2; 
Table1.Rows[i].Cells[j].Text = rate.month3; 
Table1.Rows[i].Cells[j].Text = rate.month6; 
Table1.Rows[i].Cells[j].Text = rate.month12; 

testlabel.Text = rate.code; 

我不使用一gridview,因爲表格的結構很複雜。

有什麼想法嗎?

回答

0

請看用戶評論here。回發行爲問題在SharePoint 2010中是相同的。嘗試實施EnsurePanelFix() - 方法。

+0

此鏈接中的2個樣本不適用於我。無論如何 – Dino 2012-01-31 15:30:06

相關問題