DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 14 Aug 2007 11:08:14 -0300,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Paulo
          2    Ladislav Mrnka


Doubt new window   
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
Date:Tue, 14 Aug 2007 11:08:14 -0300   Author:  

RE: Doubt new window   
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
> 
> 
> 
> 
Date:Tue, 14 Aug 2007 08:06:04 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us