【发布时间】:2017-06-14 20:10:01
【问题描述】:
我创建了一个从 aspx 页面打开的对话框。该对话框包含信息以及页脚上的按钮。合并和关闭。
下面是我用来打开的对话框。这已成功创建并且信息已被填充。但是,当我单击对话框的“合并”按钮时,它什么也不做,因为导航不会转移到代码隐藏文件中。
我已经在后面的代码上成功定义了 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>×</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 事件。
【问题讨论】:
-
你在任何地方都使用过更新面板吗?
-
不,我没有使用更新面板
-
我找不到属性“AutoPostBack”
-
查看我的回答here。模态可能将按钮放在
</form>之外。 -
@VDWWD:谢谢你的回答。有效。顺便说一句,是否有可能更改链接按钮。即让它看起来像一个按钮