Doubt new window

Discussion in 'ASP .Net' started by Paulo, Aug 14, 2007.

  1. Paulo

    Paulo Guest

    Hi, when I click a Search button, must open a new window wich will list all
    the customers on a grid, and the user can search, etc, but when the user
    choose the customer, the window must be closed and returned to the original
    window with the customer ID selected by the user...

    How can I do that? any examples? Im using VS 2005 C# .net 2.0...

    Thanks
     
    Paulo, Aug 14, 2007
    #1
    1. Advertising

  2. Hi Paulo,
    you have to use javascript. On the search button use something like
    OnClientClick="javascript:OpenMyWindow(); return false;"

    Now you have to define two javascript functions OpenMyWindow and UpdateValue
    function.
    function OpenMyWindow() {
    window.open("~/Customers.aspx", other params to set up your new window);
    }

    function UpdateValue(returnCustomer) {
    var customerTextBox = document.getElementById('customerTextBox');
    customerTextBox.Value = returnCustomer; // updates value in some html
    textbox

    // you will probably have to refresh value here
    if (document.createEvent) {
    var onchangeEvent = document.createEvent('HTMLEvents');
    onchangeEvent.initEvent('change', true, true);
    customerTextBox.dispatchEvent(onchangeEvent);
    }
    else {
    customerTextBox.fireEvent('onchange');
    }
    }

    Customers.aspx will handle your grid with customers. You also need to
    implement return mechanism on this page. Say for example if user select row
    in grid it will return customer name back to previous window. You again need
    to use javascript:

    function Done(returnValue) {
    window.opener.UpdateValue(returnValue); // calls UpdateValue defined in
    previous window
    window.close();
    }

    I don't say it will work exactly as I have described but at least it gives
    you an idea.

    Regards,
    Ladislav


    "Paulo" wrote:

    > Hi, when I click a Search button, must open a new window wich will list all
    > the customers on a grid, and the user can search, etc, but when the user
    > choose the customer, the window must be closed and returned to the original
    > window with the customer ID selected by the user...
    >
    > How can I do that? any examples? Im using VS 2005 C# .net 2.0...
    >
    > Thanks
    >
    >
    >
    >
     
    =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?=, Aug 14, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Tm92aWNl?=
    Replies:
    2
    Views:
    6,718
    Alan Ferrandiz Langley
    Jun 9, 2004
  2. Bob Nelson

    doubt about doubt

    Bob Nelson, Jul 28, 2006, in forum: C Programming
    Replies:
    11
    Views:
    659
  3. Replies:
    0
    Views:
    593
  4. Peter Otten
    Replies:
    2
    Views:
    139
    Cousin Stanley
    Aug 10, 2013
  5. Terry Reedy
    Replies:
    0
    Views:
    136
    Terry Reedy
    Aug 10, 2013
Loading...

Share This Page