passing parameters while opening a new window

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: passing parameters while opening a new window

  1. #1
    Join Date
    Apr 2010

    Question passing parameters while opening a new window

    I'm quite new in developing and I'm having some problems with passing url parameters.
    I'm writing in ( and usually when creating an event, I'm using this:

    dim paramName as string
    paramName = request.querystring("CODE")....

    ...btn_onclick ()...
    response.redirect("1.aspx?code=" & paramName)

    The problem is that now I need to do the same, but open the new page in a new window.
    I understand that I need to use and write some javascript
    (I thought at first that I need target="_blank")
    Since I'm not that familiar with javascript I don't really understand how to pass a parameter from the previous page to the new one


  2. #2
    Join Date
    Oct 2008

    hi there,

    i use this function:

    //beginning of javascript function
    function openWindow(aName,aMode,anID,aService,h,w,TableSize) {

    var vUrl= "<an url>?aName=" + aName + "&aMode=" + aMode + "&anID=" + anID + "&aService=" + aService + "&H=" + h + "&W=" + w + "&TableSize=" + TableSize;

    var vWindow ="", "vWindow", "width=" + w + ",height=" + h + ",menubar=no,toolbar=no,status=no,personalbar=no,resizable=yes,scrollbars=no");
    if (vWindow == null)
    alert("Please disable pop-up blockers");
    vWindow.moveTo(0, 0);

    //end of javascript function

    then in in a code-behind page of an aspx file, I have somewhere:
    'beginning of code
    sb.Append("<td align=""center""><a href=""vWindow"" onclick=""")
    sb.Append("openWindow('") 'and so forth
    'end of code

    which creates dynamic html. thus, when somebody clicks such link it opens a pop-up window.
    now, i know you want something different, which is to redirect to 1.aspx in a pop-up window. well, i haven't done that, but maybe this will work (you just have to let us know...)

    instead of:

    response.redirect("1.aspx?code=" & paramName)

    change to:

    response.write("<script language='javascript'>return openWindow(" + <send parameters as string values> + ";</script>")

    and inside openWindow, <an url> would be "1.aspx"

    maybe, this is that simple, or needs more work to be done.

    i wish you luck,

    tonci korsano

Similar Threads

  1. Replies: 13
    Last Post: 05-31-2011, 07:11 AM
  2. Replies: 1
    Last Post: 12-24-2007, 12:30 AM
  3. Regarding closing a pop window
    By Usha.R in forum ASP.NET
    Replies: 1
    Last Post: 02-14-2006, 03:30 AM
  4. Replies: 0
    Last Post: 06-04-2001, 10:17 AM
  5. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 8
    Last Post: 09-26-2000, 02:34 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center