Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7833095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:33:45+00:00 2026-06-02T12:33:45+00:00

I have a button in a GridView, and when it is clicked it triggers

  • 0

I have a button in a GridView, and when it is clicked it triggers the

protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)

event. In there I have some logic and at the end I am registering some javascript that generates a pop up. The issue I am having is that for the confirm pop up when it comes up. It shows a blank screen on the background and when I click cancel it shows it back again, otherwise it navigates to another page… But while the box is up the background is white.

I need to make it so that it shows like the “Alert” pop up that still shows the website in the background. Please note I can only make this work with these pop ups as they are used throughout the website (“not confirm ones”). This is the first confirm box I have had to add but there are many Alerts on other pages. So would not like to change them as it will be too much work (150+ pages website).

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:33:47+00:00Added an answer on June 2, 2026 at 12:33 pm

    It looks like the page isn’t getting a chance to render before the alert box shows up. Hook up the code that displays the JavaScript alert to something like the body.onload event; this will wait for the page to finish its initial load before displaying the alert.

                Page.ClientScript.RegisterClientScriptBlock(
                    this.GetType(), 
                    "key",
                    @"
    function Redirect() {
      location.href = 'shoppingCart.aspx';
    }
    
    function showAlert() {
      if (confirm('***Message truncated***.') == true){
        Redirect();
      };
    }
    
    // If you're using JQuery, you could do something like this, otherwise you
    // would need to add the function call to the HTML body tag's onload attribute.
    // There are other alternatives, see:
    // http://stackoverflow.com/questions/1235985/attach-a-body-onload-event-with-js
    $(document).ready(function() {
      showAlert();
    });
    
    ", true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView, each row has Edit button. After it's clicked, one of
I have a Gridview and when the edit button is clicked the details of
I have a Gridview., usually, when the delete command button is clicked then the
I have a gridView in ConsumerList page. When Edit button is clicked (in each
I have a button inside of a gridview's template field. Onclick i want to
want to have a Hyperlink-Button in a gridView in which I can display a
I have a Clear button which sets the gridview datasource to null and binds
I've got a gridview that renders as a table. I have an Add button
I have a gridview with multiple rows, each has a Update button and I
I have a TemplateField column in a gridview with a button inside of it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.