473,395 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Any thoughts on transferring data between pages?

I am looking for some guidance on transferring data between two pages in my
ASP.net Web app (intranet).
I have a form that will have a button and a text box on it (among other
controls of course)
When I click the button, I want to open a contacts page which is already
built and functional. From there I want the user to select a contact (using
the search and browse tools on that page)
When the user selects one of the contacts, I want the information I store to
a string to appear in the text box on the original form. Closing the form may
happen but I can take care of that.
Now the big question is how do I send this information to the original page?
I can use cookies, and I can use session variables, but how will I tell the
text box to update its info?
The only way that I can think of accomplishing this is by designing my own
class (in a module, so it is page independent) and have an event that fires
when the data comes in. This still is a bit fuzzy to me and is going to take
me a while to figure out, as I still have to deal with view states, and see
what is going to happen.
Is there some way of doing this that I am missing?
Jul 21 '05 #1
1 1594
Jed
I like to use javascript to send the desired value back to the parent window.
Here is the code I use. Just put this code in a picker.js file and include
it in
both the parent and spawned pages.

//This finds the id of the form the named field is on
//It could be avoided if you alter the input parameters for
//launchPicker
function findParentFormIndex(strElementName) {
for (x = 0; x < document.forms.length; x++)
for (y = 0; y < document.forms[x].length; y++)
if (document.forms[x].elements[y].name == strElementName)
return x;
}

//this opens the "picker" window passing the full current field and value
//I call this from a button or link on the parent page.
function launchPicker(fieldName, fieldValue) {
var parentFormIndex;
parentFormIndex = findParentFormIndex(fieldName);
var thisField = eval('document.'+ document.forms[parentFormIndex].name
+'.'+ fieldName);
if (thisField.onchange == null) { thisField.onchange = fieldChange; }
if (fieldValue == null) { fieldValue = thisField.value; }
//change the url to suite your fancy.
winEmail = window.open(
'/includes/picker_category.asp?' +
'page_action=single_select' +
'&fieldName='+ document.forms[parentFormIndex].name +'.'+ fieldName +
'&fieldValue='+ fieldValue,
'winPicker',
'top=50,left=50,scrollbars=yes'
);
}

//this defines the onChange event for fields where it is not defined
function fieldChange() {}

//this returns the value to the desired field
//call this from the spawned page using
//the variables as received from the querystring
//changeing fieldValue if appropriate.
function openerSetVal(fieldName, fieldValue) {
eval('window.opener.'+ fieldName +'.value = "'+ fieldValue +'"');
self.close();
try {
eval('window.opener.'+ fieldName +'.onchange()');
} catch(err) {
//some textboxes don't like the onchange event
return;
}
}

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: hzomorodi | last post by:
Hi, I am trying to find methods/tools that will help me automate the process of manually copying some data from one web page form and pasting them to another. We have to frequently fill out a...
2
by: Rani | last post by:
hi guys I don't know if this is the right place for it but I created 2 pages in page one there is a text box in which the user enters his name, in page 2 there is a the same text box. I would...
3
by: ESmith | last post by:
I have multi-page form where I pass an object between pages as follows: On each page: // What page to go to next private void btnContinue_Click(object sender, System.EventArgs e) { if...
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
1
by: Asaf | last post by:
Hi, I am developing a windows forms client application that will send a large XML data to a web server using Web Services. I saw this article http://www.codeproject.com/soap/MTOMWebServices.asp...
9
by: John | last post by:
Tried this on microsoft.public.access.gettingstarted - no response - perhaps more appropriate here. I'm not a database user, simply helping someone get started with a new computer. The old...
3
by: JayD | last post by:
(Not sure whether it is a general aspnet problem or a specific security problem, hence posting it in 2 groups). This will solve for us a number of problems. I have developed a website on my...
1
by: jmar | last post by:
I posted on this topic a while back and received some good responses. However, I have better insight into what I'm looking to do so I am tapping the wealth of experience here again hoping to find a...
3
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.