提问人:Karthik Nagaraj 提问时间:6/2/2017 更新时间:6/2/2017 访问量:30
asp:按钮在第二次单击时不触发服务器函数
asp:button not firing server function on second click
问:
我有一个asp:button:
<asp:Button runat="server" ID="btnschedule" Text="Schedule" OnClick="btnschedule_Click" CssClass="btn btn-default custom-button" />
单击按钮后,将调用以下函数:
protected void btnschedule_Click(object sender, EventArgs e)
{
if (txtcertcode.Text == "")
{
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "showTrainingScheduleModal('courseErr');", true);
}
else
{
foreach (ListItem item in chk_ModeList.Items)
{
if (item.Selected)
{
pnlschedule.Visible = true;
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "showTrainingScheduleModal();", true);
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "showTrainingScheduleModal('chkErr');", true);
}
}
dt_sch.Clear();
grdviewschedule_training.DataSource = null;
grdviewschedule_training.DataBind();
}
}
在代码中
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "showTrainingScheduleModal('chkErr');", true);
JavaScript 函数正在打开引导模式
问题出在第一次单击引导模式打开时,但是当我关闭模式并再次单击按钮时,没有任何反应。
实际工作应该像每次单击按钮模式应该打开一样。
任何帮助都会得到赞赏。 提前致谢。
答: 暂无答案
评论
ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "showTrainingScheduleModal('chkErr');", true);