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

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Question passing parameters while opening a new window

    Hey
    I'm quite new in developing and I'm having some problems with passing url parameters.
    I'm writing in vb.net (asp.net) 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 window.open() 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



    Thanks,
    D.

  2. #2
    Join Date
    Oct 2008
    Posts
    142

    window.open

    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 = window.open("", "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.focus();
    vWindow.location=vUrl;
    vWindow.moveTo(0, 0);

    }
    //end of javascript function

    then in vb.net in a code-behind page of an aspx file, I have somewhere:
    'beginning of vb.net code
    sb.Append("<td align=""center""><a href=""vWindow"" onclick=""")
    sb.Append("openWindow('") 'and so forth
    'end of vb.net 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, 08:11 AM
  2. Replies: 1
    Last Post: 12-24-2007, 01:30 AM
  3. Regarding closing a pop window
    By Usha.R in forum ASP.NET
    Replies: 1
    Last Post: 02-14-2006, 04:30 AM
  4. Replies: 0
    Last Post: 06-04-2001, 11:17 AM
  5. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 8
    Last Post: 09-26-2000, 03: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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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