0

我有一个 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函数正在打开一个引导模式

问题在于首先单击引导模式打开,但是当我关闭模式并再次单击按钮时,没有任何反应。

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

任何帮助都将不胜感激。提前致谢。

4

0 回答 0