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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:51:04+00:00 2026-05-21T19:51:04+00:00

Ok, I hope I can explain this well enough. I have one or more

  • 0

Ok, I hope I can explain this well enough.

I have one or more third party Up/Down Spinner+Textbox controls on my page that are black boxes that I can’t change the source for.

I want the user to change the UpDownControl contents to choose a quantity and then click a calendar button which will:

  1. Add the quantity of all Up/Down boxes.
  2. Call a javascript popup to display a calendar with the count from step 1 in the url “…calendar.asp?qty=5”.

My problem is getting the two steps to execute in the same click. As it stands I can click the button once and it counts
the items and adds them to the popup string and then I have to click it a second time to actually execute the JS popup window.

The code was originally written to “load up” the counts into a second button and then programmatically click it but that looks
like a popup to the browsers since the user didn’t click that button.

Here is what I have so far that almost works —

On my page:

<asp:ImageButton ID="btnPrepCal" runat="server" Text="PrepCal" OnClick="btnPrepCal_Click" ImageUrl="~/images/Calendar.gif"/>        

In code behind:

public void btnPrepCal_Click(object sender, EventArgs e)
{
StringBuilder sbParams = new StringBuilder();  

int TotalQty = 0;
int basketItemCount = 0;
int rowIndex = 0;
string Sku = string.Empty;

foreach (GridViewRow varRow in VariantGrid.Rows)
{
    int qnty = GetControlValue(varRow, "Quantity", 0);
    if (qnty > 0)
    {
        basketItemCount++;
        string optionList = (string)VariantGrid.DataKeys[rowIndex].Value;
        ProductVariant variant = _VariantManager.GetVariantFromOptions(optionList);

        if (variant != null)
        {
            BasketItem basketItem = GetBasketItem(optionList, varRow);      
            if (basketItem != null)
            {
                TotalQty += basketItem.Quantity;                    
                Sku = variant.Sku;                          
            }
        }
    }
    rowIndex++;
}
if(Sku.Length > 4) Sku = Sku.Substring(0,4);
sbParams.Append(string.Format("?sku={0}&Qty={1}", Sku, TotalQty));
string popup = string.Empty;
popup = string.Format("window.open('http://trustedtours.org/store/egalaxycalendar.asp{0}','Reservation Calendar','width=265,height=465')",sbParams.ToString());
btnPrepCal.OnClientClick = popup;

}

I’m new to .NET and web programming so I’m probably going at it totally backwards so any help is appreciated. I apologize if it’s not clear what I’m trying to do or how. If you need any more info please ask – the rest of the file is a lot of shopping cart mumbo jumbo so I left it out, I hope it’s enough.

—- update —-
After looking at the referenced pages I get:

Type cstype = this.GetType();
ClientScriptManager cs = Page.ClientScript;             
StringBuilder cstext1 = new StringBuilder();
cstext1.Append("<script type=text/javascript>" + popup + "<script>");
cs.RegisterStartupScript(cstype, "PopupCalendar", cstext1.ToString());

And I believe this is added after I set the value of popup near the bottom of my Click handler above, removing the OnClientClick part, right?

Should this popup the other window on a page reload after clicking the button? (I hate being a newb and asking what’s probably obvious questions.)

  • 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-05-21T19:51:05+00:00Added an answer on May 21, 2026 at 7:51 pm

    You can accomplish what you’re aiming for using the ClientScriptManager.RegisterStartupScript method. Instead of assigning the OnClientClick method of the button to your JS popup code, set that code to run when the page is reloaded using the RegisterStartupScript method.

    This page has some good examples: http://dotnetslackers.com/articles/aspnet/JavaScript_with_ASP_NET_2_0_Pages_Part1.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope I can explain this well enough so that you can understand the
I hope I can explain this clearly enough. I have my main form (A)
Here's an interesting one... hope I can explain it well... I have a collection
I hope I can explain the question well enough. I have a table with
I hope I can explain this well enough... I've created an xml document with
Now this is tricky... I hope i can explain it well.. I have a
I hope I can explain this problem decently well! I'm trying to implement a
I hope I can explain this right I have two input fields that require
First-timer here, I hope I explain this well enough... PHP/Smarty, I'm working on a
I hope I can explain this clearly: I have two tables with the following

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.