473,395 Members | 1,502 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.

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.EventArgs) Handles MyBase.Load

Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
End Sub

and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = Request("a").ToString
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 9776
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 openWindowInjectScript(){
string myScript;
myScript = "<scr" + "ipt>window.open('WebForm2.aspx?a=" + txtIdfield.Value
+ "',null,'height=250, width=250,status= no,resizable= no, scrollbars=no,
toolbar=no,location=no,menubar=no'); </scr" + "ipt>";
this.Page.RegisterStartupScript("JavaScript",myScr ipt);
}

In the webform1.aspx button1_Click event
private void Button1_Click(object sender, System.EventArgs e)
{
openWindowInjectScript();
}
Basically openwindowInjectScript 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.com" 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.EventArgs) Handles MyBase.Load

Button1.Attributes.Add("onclick", "window.open('WebForm2.aspx?a=" +
TextBox1.Text.ToString + "',null,'height=250, width=250,status= no,
resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
End Sub

and following code in webform2:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = Request("a").ToString
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('page,aspx?value=" + myval +
"',null,'height=200,width=900,status=yes,toolbar=n o,menubar=no,location=no');
");
Response.Write("</SCRIPT>");

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

dy****@yahoo.com wrote in message news:<11**********************@g43g2000cwa.googleg roups.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
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...
13
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. ...
1
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...
1
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...
1
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? ...
1
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....
6
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="#"...
1
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...
3
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...
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
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...

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.