473,625 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return to parent window with return value from datagrid

1 New Member
Hi,
Please anyone help me, I have a datagrid on my child window wherein I have to return the value of the datagrid on the parent window when I click the link button.
Or do you have any sample code that return value from datagrid to parent window.... please need help.


Please help me...
Jul 19 '07 #1
1 2123
RoninZA
78 New Member
You'll have to add a property to your child form, and then instead of closing the child form, hide it, then the object will still be available from the parent form, and you'll be able to access the property, disposing of the child form after.

In C# it will look something like this (I'm using a string as example, but you'd obviously modify it to fit in with your requirements:
In your child form
Expand|Select|Wrap|Line Numbers
  1. private string returningValue = string.empty;
  2.  
  3. public string SelectedValue
  4. {
  5.     get { return returningValue.Trim(); }
  6. }
  7.  
In your exit code it should look similar to this:
Expand|Select|Wrap|Line Numbers
  1. .
  2. .
  3. .
  4. returningValue = <the value you want to access from the parent form>;
  5. this.Hide();
  6.  
Then in your calling form it should look like such:
Expand|Select|Wrap|Line Numbers
  1. .
  2. .
  3. .
  4. frmMyChildForm form = new frmMyChildForm();
  5.  
  6. //using ShowDialog() because you want the child form to retain focus, 
  7. //instead of this code just running through
  8. form.ShowDialog();
  9.  
  10. //Access the SelectedValue property of our form object
  11. MessageBox.Show("The selected value is " + form.SelectedValue);
  12.  
  13. //Close (dispose) our form object
  14. form.Close();
  15.  
[In Borat voice] Yegshamaz!
Jul 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
8169
by: Lee | last post by:
I am using a modal window and an iFrame to try and pull a return value back. I am doing this across domains. I have the value returned from the modal window to the iFrame window but I can not get the value returned to the parent window. The alert in the parent window always returns undefined errors. Any help would be much appreciated. I call the modal window and wait for the return as such: function LCC()
1
1670
by: cksj | last post by:
I have a link on my web app that opens a pop-up window. In the pop-up window, the user can search for policy information. The result is displayed on a datagrid. The datagrid has 1 hyperlink column and 3 bound columns. When the user clicks the hyperlink, it passes the data of the hyperlink to the parent window. This part works great. However, I would like to pass the data on all 4 columns to the parent window. Do you know how I can do this?...
6
9850
by: mkobus | last post by:
Im relatively new, so please be patient with me... I need to update a parent .aspx screen from a popup and close the popup. Normally I would use 'window.opener.location.reload(true);self.close();' but i need the parent window not to reload or else data that the user has already entered will be lost during the IsPostBack. I need the 'Apply' button on the popup to trigger the 'Update' button on the parent screen. The script ive seen...
4
2786
by: KenG | last post by:
Hi: I have a datagrid that builds a hyperling which uses javascript to open a new window. The new window opens and displays fine, however, the original window that has the grid, is now blank with only "" displayed in an otherwise empty window. To restore the datagrid in that window, I have to use the browsers "back" button. How can I stop the parent window from changing?
1
2403
by: Steve Bywaters | last post by:
I'm attempting to do a lookup, using a javascript-launched child window to enable the user to select a value, then return that value to the parent/launching window. Pictures... to demonstrate the issue: http://users.bigpond.net.au/stevebywaters/image1.gif shows the first window. The operator can press the 'Select' button (to get a value to put into 'Location' entry field). When they do, a child window is launched, showing a list of...
6
8142
by: Mark Goldin | last post by:
I have main aspx page with a button that will show a modal dialog in the Browser when a user clicks on the button. On the modal form the user will do some selections. The he will submit his selections to the server via a postback. How can I take these selections to the main page? Thanks
4
1712
by: Antonio | last post by:
Hi, i have a user control that is a pop-up search tool. The user enters the criteria and are presented wiht a datagrid. They can select the right one. I raise this event. The parent page catches the event (sender, e). But what is the right way to send to the parent a value from the datagrid? Can I put that value in the event I raise? Its just an integer. When the parent catches the error, I want to have that integer in hand....
1
3005
by: ABC | last post by:
I has a parent and a popup lookup ASP.NET Form. Both has javascript. I test the popup window's window.Form1.SelectedProductCode.value has a value. But don't know why the return variable "retvar" has not any value pass from popup? -- Parent Windows Script function DoSelectProductCode() { var selectedstr = "";
4
9682
by: Phil Powell | last post by:
I thought this would work but it seems to not work neither in Netscape nor in IE: <script type="text/javascript"> <!-- // OBTAINED FROM http://www.javascripter.net/faq/settinga.htm // NOTE THAT IF YOU SET days TO -1 THE COOKIE WILL BE SET TO YESTERDAY
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8192
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1504
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.