473,698 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass parameter to Popup window

I have 2 webform in vb.NET application.
On Webform1, I have one text box1 and one button.
on Webform2, I have one text box .
I need transfer the value of textbox 1 in webform1 to textbox2 in
webform2. and popup webform2 when user click on the button on webform1.

I have code in webform1:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Button1.Attribu tes.Add("onclic k", "window.open('W ebForm2.aspx?a= " +
TextBox1.Text.T oString + "',null,'height =250, width=250,statu s= no,
resizable= no, scrollbars=no, toolbar=no,loca tion=no,menubar =no ');")
End Sub

and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
TextBox1.Text = Request("a").To String
End Sub
I could not get the result unless I click on the button1 twice. i know
what happen in here but have no solution. I will be appreciated if you
could help here.

Thanks in advanced,
Di

Nov 19 '05 #1
4 9801
Hi ,
You can achieve this by injecting a javascript in the Button1 click
event on the server side . Write an function to inject an javascript in the
webform1 button1 click.
Don't do anything with Attributes of button1 as it won't achieve result u
requires as the 1st page the textbox1 value would be blank.

private void openWindowInjec tScript(){
string myScript;
myScript = "<scr" + "ipt>window.ope n('WebForm2.asp x?a=" + txtIdfield.Valu e
+ "',null,'height =250, width=250,statu s= no,resizable= no, scrollbars=no,
toolbar=no,loca tion=no,menubar =no'); </scr" + "ipt>";
this.Page.Regis terStartupScrip t("JavaScript", myScript);
}

In the webform1.aspx button1_Click event
private void Button1_Click(o bject sender, System.EventArg s e)
{
openWindowInjec tScript();
}
Basically openwindowInjec tScript register a script at pageload and which
will make to open an window with current values.

This is the way out for it and it should work
Regards
IntelYogi
"dy****@yahoo.c om" wrote:
I have 2 webform in vb.NET application.
On Webform1, I have one text box1 and one button.
on Webform2, I have one text box .
I need transfer the value of textbox 1 in webform1 to textbox2 in
webform2. and popup webform2 when user click on the button on webform1.

I have code in webform1:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Button1.Attribu tes.Add("onclic k", "window.open('W ebForm2.aspx?a= " +
TextBox1.Text.T oString + "',null,'height =250, width=250,statu s= no,
resizable= no, scrollbars=no, toolbar=no,loca tion=no,menubar =no ');")
End Sub

and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
TextBox1.Text = Request("a").To String
End Sub
I could not get the result unless I click on the button1 twice. i know
what happen in here but have no solution. I will be appreciated if you
could help here.

Thanks in advanced,
Di

Nov 19 '05 #2
Thank you for your reply. But actually I tried and this did not work
for some reason, any idea?

Nov 19 '05 #3
Try this onClick event of your button

Response.Write( "<SCRIPT>") ;
Response.Write( "window.open('p age,aspx?value= " + myval +
"',null,'height =200,width=900, status=yes,tool bar=no,menubar= no,location=no' );
");
Response.Write( "</SCRIPT>");

I think this will do the trick, tell me if not

dy****@yahoo.co m wrote in message news:<11******* *************** @g43g2000cwa.go oglegroups.com> ...
Thank you for your reply. But actually I tried and this did not work
for some reason, any idea?

Nov 19 '05 #4
i'd tried both suggest solutions from Yogi, but it seems not work for me....is any solution yet?

the prob is...webform2's page_load will be run 1st b4 the button_click event run...so any wisdom can help up?

From http://www.developmentnow.com/g/8_20...pup-window.htm

Posted via DevelopmentNow. com Groups
http://www.developmentnow.com
Jan 24 '06 #5

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

Similar topics

3
2896
by: Treetop | last post by:
I would like to pass text to a popup window to save creating a new html file for each help topic. I would like to have a value for the heading, a value for the text, code for printing the help page, and code to close the window. ------------------------------------------ the help window code is following <SCRIPT LANGUAGE="JavaScript"> <!-- Begin
13
26983
by: Al Franz | last post by:
Anyone understand how to pass parameters to a JavaScript. If anyone finds this easy to do maybe they could take a look at my short script on this page and show me how it needs to be changed. http://franz.org/java.htm Thanks for any help.
1
2730
by: William Starr Moake | last post by:
The browser-based WYSIWYG editor I'm developing has a popup window with a form that generates table code from user input (width, border, cols, rows, bgcolor.) But the user has to copy-paste the generated table HTML into the editor window as it works now. How do I pass the form-generated HTML directly to the editor window so copy-paste is not necessary? I know I have to set focus on the editor window in the generate table code function, but...
1
12996
by: TErnst | last post by:
Hello All.... What I am attempting to do is have a link/button on a page (testpopup.cfm) that opens a popup page (popupwindow.cfm). The popup page displays a resultset from a query and the selected record needs to be passed through a query string/URL parameter to the original calling page and will be available in the body onload event of the calling page. I open the popup window and display the query results, I then click on
1
1642
by: Steven | last post by:
I have an arraylist and I want to display all the values in the arraylist in a new window (asp.net page) using a datalist. The new window should be like a small popup window. How can I do this? Regards -- Steven
1
1752
by: kebabkongen | last post by:
Hi, I am working on an application where I make a popup window with a long list of users (with checkboxes) I am trying to figure out how to pass the list of selected users to the parent window. I have seen this be done by one field, such as "date pickers" from a calendar popup. Can anyone please give me a pointer to how I place the parameters from the popup window in the parent window?
6
4400
by: Ellie | last post by:
In my program the user clicks on a link and using the window.open function, opens a new window. I pass a url to the new window like this: <a href="#" onClick="window.open('../quotescreenwindow.php?enroll_id=enrollwindowprime.php', 'WindowC', 'width=750,height=800,scrollbars=yes');"> In the new window that just opened called quotescreenwindow.php, I
1
9363
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i need to open the new page in the main page window with passing the two textbox parameters into the new page. Program opens the new page but dont know how to pass the two textboxes values into the new page name deceasedToday.asp Needs help in...
3
1543
by: chpadmamca | last post by:
Hi , I need this very urgent.please help me. I have to send a parameter on to the popup window which will open when a command button is clicked,again i need to display that parameter on the popup window. any help would be greatly appreciated.
0
8604
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
9157
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...
1
8895
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
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...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
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
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.