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

  • Home
  • SEARCH
  • 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 535807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:45:20+00:00 2026-05-13T09:45:20+00:00

I need to pass 4 arguments (3 strings and one comma separated list) from

  • 0

I need to pass 4 arguments (3 strings and one comma separated list) from an ASP.NET page to another ASP.NET page using jQuery. The destination page ought to be launched as a separate window, which works fine with the following jQuery snippet:

$('#sourcePageBtn').click(function(){
   window.open("destinationPage.aspx");
   return false;
});

How can I pass the arguments to the destination page? I am trying to avoid the query string to pass the arguments because:

  1. I don’t want to show the url arguments (which can also be very long) in the destination window.

  2. There are some special characters like ‘,/,\, & etc. in the string arguments.

Please suggest.

Edit:
I’m trying to access the arguments in the script section of the aspx file i.e.

<script language="C#" runat="server">
    protected void Page_Load ( object src, EventArgs e) 
    {
     //Creating dynamic asp controls here
    }
</script>

My specific need for the arguments in the Page_Load of the script section stems from the fact that I am creating a few dynamic Chart controls in the Page_Load which depend on these arguments.

cheers

  • 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-13T09:45:20+00:00Added an answer on May 13, 2026 at 9:45 am

    Initial Thoughts (before solution created)

    1. Use POST for large data instead of GET. With POST no querystring will be used for data and therefore URL length restriction isn’t a concern. (The max URL length differs between browsers so you’re right to stay away from it when large data is moving).

    2. Special URL characters can be encoded to be passed in the query string so that shouldn’t be an issue.

    Alternatively you might store the data on the server side from the first page, and have the second page pick it up from the server side. But this is overkill. And it makes you do unneeded server programming.

    Passing state via HTTP calls is standard practice. You shouldn’t try to circumvent it. Work with it. All the facilities are built in for you. Now it’s just up to jQuery to provide us some help…

    Note: Be careful using jQuery for main app features in case JavaScript is disabled in the browser. In most cases your web application should be usable at a basic level even when JavaScript is disabled. After that’s working, layer on JavaScript/jQuery to make the experience even better, even awesome.

    Edit: Solution (with ASP.NET processing)

    Key resources for solution implementation are:

    • How use POST from jQuery – initiates the request, passes arguments, gets response
    • jQuery context argument – this is how the popup window DOM is accessed/affected from the main window

    How it works: From a main page, a POST occurs and results are displayed in a popup window. It happens in this order:

    • The main script opens a popup window (if it doesn’t already exist)
    • main script waits for popup window to fully initialize
    • main script POSTs (using AJAX) arguments to another page (sends a request)
    • main script receives response and displays it in the popup window.

    Effectively we have posted data to a popup window and passed arguments to the processing.

    Three pages follow and they constitute the complete solution. I had all 3 sitting on my desktop and it works in Google Chrome stable version 3.0.195.38. Other browsers untested. You’ll also need jquery-1.3.2.js sitting in the same folder.

    main_page.html

    This is the expansion of the logic you provided. Sample uses a link instead of a form button, but it has the same id=sourcePageBtn.

    This sample passes two key/value pairs when the POST occurs (just for example). You will pass key/value pairs of your choice in this place.

    <html>
    
    <head>
    <script type="text/javascript" src="jquery-1.3.2.js"></script>
    </head>
    
    <body>
    
    <a id="sourcePageBtn" href="javascript:void(0);">click to launch popup window</a>
    
    <script>
    
    $(function() {
     $('#sourcePageBtn').click( function() {
    
      // Open popup window if not already open, and store its handle into jQuery data.
      ($(window).data('popup') && !$(window).data('popup').closed) 
       || $(window).data('popup', window.open('popup.html','MyPopupWin'));
    
      // Reference the popup window handle.
      var wndPop = $(window).data('popup');
    
      // Waits until popup is loaded and ready, then starts using it
      (waitAndPost = function() {
       // If popup not loaded, Wait for 200 more milliseconds before retrying
       if (!wndPop || !wndPop['ready']) 
        setTimeout(waitAndPost, 200);
    
       else  { 
           // Logic to post (pass args) and display result in popup window...
        // POST args name=John, time=2pm to the process.aspx page...
        $.post('process.aspx', { name: "John", time: "2pm" }, function(data) {
         // and display the response in the popup window <P> element.
         $('p',wndPop.document).html(data);
        });
       }
      })(); //First call to the waitAndPost() function.
    
    
     });
    });
    
    </script>
    </body>
    </html>
    

    popup.html

    This is the popup window that is targeted from the main page. You’ll see a reference to popup.html in the jQuery script back in the main page.

    There’s a “trick” here to set window['ready'] = true when the popup window DOM is finally loaded. The main script keeps checking and waiting until this popup is ready.

    <html>
    
    <head>
    <script type="text/javascript" src="jquery-1.3.2.js"></script>
    </head>
    
    <body>
     <!--  The example P element to display HTTP response inside -->
     <p>page is loaded</p>
    </body>
    
    <script>
        $(function() {
         window['ready'] = true;
        });
    </script>
    
    </html>
    

    process.aspx.cs (C# – ASP.NET process.aspx page)

    The dynamic server page the arguments are POSTed to by the main page script.
    The AJAX arguments arrive in the Page.Request collection.
    The output is delivered back as plain text for this example, but you can customize the response for your apps requirements.

    public partial class process : System.Web.UI.Page {
    
        protected void Page_Load(object sender, EventArgs e) {
            // Access "name" argument.
            string strName = Request["name"] ?? "(no name)";
            // Access "time" argument. 
            string strTime = Request["time"] ?? "(no time)";
    
            Response.ContentType = "text/plain";
            Response.Write(string.Format("{0} arrives at {1}", strName, strTime));
        }
    
        protected override void Render(System.Web.UI.HtmlTextWriter writer) {
            // Just to suppress Page from outputting extraneous HTML tags.
            //base.Render(writer); //don't run.
        }
    
    }
    

    Results of this are displayed into the popup window by the original/main page.
    So the contents of the popup window are overwritten with "[name] arrives at [time]"


    Main References: HTTP Made Really Easy, jQuery Ajax members and examples.

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

Sidebar

Related Questions

I need to pass an extra parameter :mobilejs => true from jQuery to a
I need to pass a variable which is captured from client side via jquery
I have a rather silly question, I need to pass a parameter from one
I need to pass multiple arguments to a function that I would like to
I need to pass argument to JNLP dynamically for which I tried using a
I need to pass Cursor object to another activity, what is the best way
I need to pass a parameter from an EditText and when I click the
I need to pass data to a variable in my master page each time
i Have an arguments like the one below which i pass to powershell script
I need a flexible way to log keyvalue pairs of arguments using System.Diagnostics.Trace. Basically,

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.