Wednesday, April 27, 2022

ASP.NET alert redirecting from one page to another within alert

HTML code

 <asp:HyperLink id="btn_StudentRegister" Text="Register Student" runat="server" CssClass="GridViewButton" NavigateUrl='<%# "./ManageStudent/RegisterStudent.aspx?CA_ID=" + Eval("Agency_id") + "&course_id=" + Eval("course_id") + "&Batch_ID=" + Eval("Batch_id") %>'/>

-----------------------------

C# code

  if (Batch_End_Date < currentdate)

                    {

                        ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('Batch End Date is over, You are not able to Register Student'); window.location='../WelcomeTP.aspx';", true);

                        return;

                    }

No comments:

Post a Comment