0
 protected void btnOkay_Click(object sender, EventArgs e)
        {
            Boolean blBill = checkBill();

            if (blBill == true)
            {
                SqlCommand cmdRegistrationID = new SqlCommand("SELECT RegistrationID FROM Registration WHERE RegistrationID = @id", conOOC);
                cmdRegistrationID.Parameters.AddWithValue("@id", txtRegistrationID.Text);

                conOOC.Open();
                SqlDataReader dtrRegistrationID = cmdRegistrationID.ExecuteReader();

                if (dtrRegistrationID.HasRows)
                {
                    while (dtrRegistrationID.Read())
                    {
                        Server.Transfer("Make Payment.aspx", true);
                    }
                }
                else
                {
                    Response.Write("<script>alert('Record Not Found.! Please Enter Correctly.');</script>");
                    txtRegistrationID.Focus();
                    txtRegistrationID.Attributes.Add("onfocus", "this.select();");
                }

                conOOC.Close();
            }
            else
            {
                Response.Write("<script>alert('You've Already Made The Payment. Thank You.');</script>");
            }

when the blBill = true and if the dtrRegistrationID.HasRows = false it will go to "else" statement and show the messagebox popup. It's success to display but if the blBill = false, it doesn't show any messagebox popup. Anyone know why? @@

2
Contributors
9
Replies
10
Views
4 Years
Discussion Span
Last Post by JorgeM
0

im not facing the problem of new line, but i am facing a problem which
Response.Write("<script>alert('You've Already Made The Payment. Thank You.');</script>");
cannot be displayed.?

0

Oh, I see what the problem is. You have an apostrophe in your text. Try this instead.

Response.Write("<script>alert('You have Already Made The Payment. Thank You.');</script>");

0

Your code:

You've Already Made The Payment. Thank You.

Change You've to You have. The apostrophe in You've is causing the problem.

0

Oh ya, i solved the problem because the single quotation. Thank for solve the problem. but i am facing the same problem but different event(Image Button Click)

        protected void imgbtPaypal_Click(object sender, ImageClickEventArgs e)
        {
            double dblTotalAmount = double.Parse(lblTotalAmount.Text) + penaltyAmt;
            string email = "OlympiaOpenCollege@gmail.com";
            string programmeName = lblProgramme.Text;
            string courseName = lblCourse.Text;
            string semester = lblSemester.Text;
            string return_URL = "http://localhost:3120/Enter%20Reference.aspx";

            generatePaymentID();
            generateBillID();
            setPayment();
            setBill();

            Response.Write("<script>alert('Please Write Down The Transaction Number After Made Payment.');</script>");

            //Build a URL String for the redirect
            string paypalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + email + "&item_name=Olympia Open College Tuition Fees +" + programmeName + "+- " + courseName + "+" + semester + "&amount=" + dblTotalAmount + "&return=" + return_URL;
            Response.Redirect(paypalURL);

any ideas why the response.write not function at all while i click the image?
i've double check for the statement, it should be alright.

0

I noticed during some testing on my own that the response.write doesnt seem to execute on the screen when there is a response.redirect executing after the response.write.

I found this explanation online:
When Response.Redirect is used the expectation is to send only the 302 header to the client. Hence by default, it flushes the response & aborts the current thread, so the subsequent action will not be performed: Source

Edited by JorgeM

0

Alright. i've solved the problem already by using two events.
one is Server Click Event what i wrote above, another one is

<asp:imageButton ID="imgbtPaypal" runat="server" 
                    ImageUrl="~/Images/Paypal.gif" onclick="imgbtPaypal_Click" OnClientClick="alert('Please Write Down The Transaction Number After Made Payment.');" />

so it's fine right now. Thank You.

And i also tried another way of doing it. Which is combine them together and call them as .Write.

Response.Write("<script>alert('hihi');window.open('" + paypalURL + "', '_self');</script>");

Edited by gahhon

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.