0

I have an asp:button:

<asp:Button runat="server" ID="btnschedule" Text="Schedule" OnClick="btnschedule_Click" CssClass="btn btn-default custom-button" />

On click of the button following function is called:

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();
        }
    }

In the code

ScriptManager.RegisterStartupScript(this, this.GetType(), System.Guid.NewGuid().ToString(), "showTrainingScheduleModal('chkErr');", true);

the javascript function is opening a bootstrap modal

The issue is on first click the bootstrap modal opens but when I close the modal and again click the button then nothing happens.

The actual working should be like on every click of the button modal should open.

Any help is appretiated. Thanks in advance.

Karthik Nagaraj
  • 143
  • 2
  • 13

0 Answers0