السؤال content not updated in UpdatePanel (in a Web Part)

  • 30 มกราคม 2555 18:02
     
      มีโค้ด

    I have to update asp controls (label and table) in my Web Part (SharePoint2010) when the user select an element in a DropDownList control. I added a EventHandler to the DropDownList that edit the label and the cells of the the table.

    I am using asp:UpdatePanel with asp:AsyncPostBackTrigger trigger.

    When debugging in VS2010, I can see that the server side method is called, the label and the table cells are updated.

    But the controls aren't updated in the Web Part when AJAX call is returned. And when I monitor the HTTP response in FireBug console, I can see that the server isn't returning the updated controls values.

    Here is the code of 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>

    And in the server side method listBoxSelectedIndexChanged (partial class ListeUserControl : UserControl), I am doing this :

    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;

    I am not using a gridview because the structure of the table is complex.

    Any idea please ?

     


    Ala
    • ย้ายโดย Brent Serbus 1 กุมภาพันธ์ 2555 1:22 maybe this is right place (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    •  

ตอบทั้งหมด