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 7809499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:27:18+00:00 2026-06-02T03:27:18+00:00

I am tryong to do the following in a Row_Command event of a gridview.

  • 0

I am tryong to do the following in a Row_Command event of a gridview. But the the pop up box never comes up, I have tried it in so many different ways.. but yet no luck. Please if someone can see the issue i would really appreciate a pointer.

protected void Gridview_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if(e.CommandName == "Merchant")
    {
        if (ItemsAvailable)
        {
            StringBuilder sb = new StringBuilder();
            MyClass class = new MyClass();
            TList<LineItems> otherItems = MyClass.GetItems(id);
            bool IsNotAvailable = false;

            foreach (LineItems item in otherItems)
            {
                Merchandise skuMerchandise = skuMerchandise.GetMerchandise(otherItems.mid);
                if (skuMerchandise  != null)
                {
                    if (skuMerchandise.AvailableItems <= 0)
                    {
                        sb.Append(OtherItems.Name);
                        sb.Append(Environment.NewLine);
                        IsNotAvailable = true;
                    }
                }
            }

            if (IsNotAvailable)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key", 
                    "function Redirect() {location.href = 'homePage.aspx';} 
                    if(confirm('The items : "+sb.ToString()+" will arrive in 1 month. 
                    Do you wish to continue?') == true){Redirect();};", true);
            }
        }
    }

Everytime i click the button, it just passes like nothing.. never prompts eveb though IsNotAvailable is true when I add a breakpoint.

  • 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-02T03:27:19+00:00Added an answer on June 2, 2026 at 3:27 am

    You can go for a simpler way,

    1. Define the javascript function in the design/separate script file so that it accepts the name of item. eg. myFunction(itemName)

    2. And in your CS file, simply add a call to that function,

      if (IsNotAvailable)
      {
      Page.ClientScript.RegisterClientScriptBlock(this.GetType(), “key”,
      “myFunction(‘” + itemName + “‘)
      }
      }

    It will make things simpler and you would be able to confirm if this is a Javascript issue or a problem in how you are writing it through CS file.

    Update:

    Your first goal should be to make sure that your JS function is working for you, so before anything, add the following code in an empty html file and run it,

    <script type='text/javascript'>
    ItemNotInStock('item');
    
    function ItemNotInStock(itemName)
    {
    var message = "The following items are no longer in stock :" + itemName + ". 
    
    Would you like to continue?";
    
    if (confirm(message) == true)
    { location.href = "homePage.aspx"; }
    
    }
    

    If you redirect correctly then do what’s mentioned below.

    Define the following javascript in your design file(tested it locally, working for me in chrome,)

    <script type='text/javascript'>
    function ItemNotInStock(itemName)
    {
    var message = "The following items are no longer in stock :" + itemName + ". 
    
    Would you like to continue?";
    
    if (confirm(message) == true)
    { location.href = "homePage.aspx"; }
    
    }
    

    In your C# code, add following line

    if (IsNotAvailable)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key", 
    string.Format("ItemNotInStock('{0}');", itemName);
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry I know similar question have been asked many times before but like most
I am trying the following piece of code in java, but it doesn't seem
Using asp.net, c# 3.5, vs 2008. I have an aspx gridview called gv1 with
Using Aspnet, C# 3.5 in vs2008 : I have sucessfully used the following code
I have a data set with the following row-naming scheme: a.X.V where: a is
I'm having a problem and I cannot understand why. I have a GridView and
I have the following Public sub: Public Sub HowToSort() Dim i As Long, j
I have the following: http://sqlfiddle.com/#!6/226ae/1 I'm trying to now add one row for each
I have a text file that contains the following data. The first line is
I have the following dataframe: > dput(py6s_pwc_16) structure(list(source = c(AERONET, BIGF, MODIS), ndvi_real =

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.