2013-03-23 120 views
0

我有一個GridView行中的更新面板。我按照所有的標準程序來更新背後從代碼面板,但似乎沒有任何工作..UpdatePanel沒有更新

   <asp:UpdatePanel ID="UpdatePanelBoost" runat="server" RenderMode="Inline" UpdateMode="Conditional"> 
             <ContentTemplate > 
             <asp:LinkButton ID="LinkButtonBoost" 
             runat="server" Font-Size="XX-Small" Text="Boost Up" 
             OnCommand="LinkButtonBoost_Command"></asp:LinkButton> 
              </ContentTemplate> 
              <Triggers> 
              <asp:AsyncPostBackTrigger ControlID="LinkButtonBoost" EventName="Command"/> 
              </Triggers> 
              </asp:UpdatePanel> 

Codebhind

protected void LinkButtonBoost_Command(object sender, CommandEventArgs e) 
{ 

    HiddenField HiddenFieldId = (HiddenField)GridView2.Rows[0].FindControl("HiddenFieldId"); 
    LinkButton Boostupbutton= (LinkButton)sender; 
    int SId= Convert.ToInt32(HiddenFieldSubjectId.Value); 
    int QId =Convert.ToInt32(GridView2.DataKeys[0].Value.ToString()); 
    UpdatePanel UpdatePanelBoost = (UpdatePanel)GridView2.Rows[0].FindControl("UpdatePanelBoost"); 

    if (e.CommandName == "Boost Up") 
    { 
     QuestionDataAccess.InsertQuestionBoost(QId, new Guid(Membership.GetUser().ProviderUserKey.ToString()), SId); 
     Boostupbutton.CommandName = "Boost Down"; 
     Boostupbutton.CommandArgument = "Boost Down"; 
     UpdatePanelBoost.Update(); 
    } 
    if(e.CommandName=="Boost Down") 
    { 
     if (QuestionDataAccess.RemoveQuestionBoost(new Guid(Membership.GetUser().ProviderUserKey.ToString()), QId)) 
     { 
      Boostupbutton.CommandArgument = "Boost Up"; 
      Boostupbutton.CommandName = "Boost Up"; 
      UpdatePanelBoost.Update(); 
     } 
    } 

}

回答