2017-06-14 61 views
0

我創建了一個從aspx頁面打開的對話框。該對話框包含頁腳上的按鈕信息。合併和關閉。在asp.net中的對話框中點擊事件不起作用

下面是我用來打開的對話框。這是成功創建和信息越來越人口。但是,當我點擊對話框的「MERGE」按鈕時,它不執行任何操作,因爲導航不會傳輸到文件後面的代碼。

我已經在我的代碼後面成功定義了Click事件,但我不明白爲什麼它沒有激發它。

aspx頁面

<div class="modal-dialog" id="updateConfirmPopUp" style="display: none"> 
    <div class="modal-content"> 
     <div class="modal-header" id="popUpHeader"> 
      <button type="button" class="close closePopup"> 
       <span>&times;</span></button> 
     </div> 
     <div class="modal-body" id="confirmData"> 
      <div id="random"></div> 
      <div class="dataTable_wrapper"> 
       <div class="table-responsive"> 
        <uc:ReviewGroupGrids ID="reviewGroupCtrls" runat="Server" /> 
       </div> 
      </div> 
     </div> 
     <div class="modal-footer"> 
      <asp:Button ID="Button1" runat="server" Text="Review Next" OnClick="btnMerge_Click" /> 
      <button type="button" id="btnClosePopUp" class="btn btn-default closePopup"> 
       Okay</button> 
     </div> 
    </div> 
</div> 

aspx.cs頁面

protected void btnMerge_Click(object sender, EventArgs e) 
    { 
     try 
     { 
      // SessionUtility.SetSession(Constants.LASTREVIEWGROUPIDPROCESSED, this.ReviewGroup.ReviewGroupId); 
      if (preventEvents) 
      { 
       Response.Redirect(Request.RawUrl, false); 
       return; 
      } 


      // ensure no action taken on current review group(partially or completly) 
      #region Handle review group for completly processed case 
      var selectedAssignment = SessionUtility.GetSession(Constants.SELECTEDUSERASSIGNMENT) as Assignment; 
      var currentReviewGroupID = hdnReviewGroupID.Value.ToString(); 

      if (currentReviewGroupID != selectedAssignment.ReviewGroupId) 
      { 
       selectedAssignment.ReviewGroupId = currentReviewGroupID; 
       SessionUtility.SetSession(Constants.SELECTEDUSERASSIGNMENT, selectedAssignment); 
       LoadNextReviewGroup(null, null); 
       lblPreviousReviewGroupId.Text = string.Format(StaticConstants.REVIEWGROUPVALIDATIONMESSAGE, currentReviewGroupID); 
       lblPreviousReviewGroupId.Visible = true; 
       return; 
      } 


      #endregion 
      if (!string.IsNullOrEmpty(selectedIds)) 
      { 
       SessionUtility.SetSession(Constants.USERSERLECTIONROWIDS, selectedIds); 
       if (BtnMerge_Click != null) 
       { 
        BtnMerge_Click(sender, e); 
       } 
       Response.Redirect("MergeGroup.aspx", false); 
      } 
     } 
     catch (Exception ex) 
     { 
      SessionUtility.SetSession(Constants.Error, ex); 
      NavigationHelper.ToErrorPage(false); 
     } 
    } 

我的客戶點擊事件正在罰款。唯一的問題是與onclick事件。

+0

你有沒有在任何地方使用更新面板? –

+0

不,我沒有使用更新面板 – Yash

+0

我無法找到屬性「AutoPostBack」 – Yash

回答

1

HTML按鈕無法調用服務器端代碼。你必須用runat =「server」標籤來使用asp按鈕。像

 <asp:Button ID="btnMerge" runat="server" Text="MERGE" OnClick="btnMerge_Click" />