Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Doubt new window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paulo - 14 Aug 2007 15:08 GMT
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
Ladislav Mrnka - 14 Aug 2007 16:06 GMT
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

> 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
[quoted text clipped - 4 lines]
>
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.