asp:按钮没有在第二次单击时触发服务器功能

时间:2017-06-01 18:14:05

标签: jquery asp.net user-controls bootstrap-modal aspbutton

我有一个asp:按钮:

<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函数正在打开一个bootstrap模式

首先点击bootstrap模式打开问题,但是当我关闭模态并再次点击按钮时,没有任何反应。

实际工作应该像每次点击按钮模式应该打开一样。

任何帮助都是有意义的。 提前致谢。

0 个答案:

没有答案