473,289 Members | 2,108 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,289 software developers and data experts.

popup window with postback...

EMW
Hi,

Is it possible with VB.NET and Javascript to popup a window, after a
buttonclick, in which the user writes some text in a textbox and then when
that window is closed with a button, the text is posted back to the aspx
program?

If it is possible, please let me know some articles about this?

thanks,
Eric
Nov 18 '05 #1
3 4522
I've done somthing similar with a selection pop-up box.
I use javascript on my main form to open a popup box. Then, when the user
selects their option, I use javasrcript to access a textbox on my parent
form, insert the text, then also use javascript to fire then postback event
on the main form, passing it the name of a submit button so any associated
events can be fired.
To access the controls on the parent form, I used:
window.opener.document.all.textboxname.value
and
window.opener.__doPostBack('buttonname', '')

I made the javascript dynamic as well... here is the javascript I created
for the popup window

// register javascript
if(!Page.IsClientScriptBlockRegistered("fillAndClo se"))
{
string script = @"<script language=""javascript"">" + "\r\n";
script += "function fillAndClose(empid){\r\n";
script += "window.opener.document.all." +
Request.QueryString["textbox"] + ".value=empid;\r\n";
script += "window.opener.__doPostBack('" +
Request.QueryString["button"] + "','');\r\n";
script += "window.close();}\r\n";
script += "</script>\r\n";
this.Page.RegisterClientScriptBlock("fillAndClose" , script);
}

So, if I just pass in the name of the textbox and the name of the button in
a querystring, the popup window will use those on the main form.

HTH,
-Cliff

"EMW" <SomeOne@MicroSoftdotCom> wrote in message
news:40**********************@dreader2.news.tiscal i.nl...
Hi,

Is it possible with VB.NET and Javascript to popup a window, after a
buttonclick, in which the user writes some text in a textbox and then when
that window is closed with a button, the text is posted back to the aspx
program?

If it is possible, please let me know some articles about this?

thanks,
Eric

Nov 18 '05 #2
EMW
Thanks!

rg,
Eric
"Cliff Harris" <he***@myrealbox.com> schreef in bericht
news:eA**************@TK2MSFTNGP09.phx.gbl...
I've done somthing similar with a selection pop-up box.
I use javascript on my main form to open a popup box. Then, when the user
selects their option, I use javasrcript to access a textbox on my parent
form, insert the text, then also use javascript to fire then postback event on the main form, passing it the name of a submit button so any associated
events can be fired.
To access the controls on the parent form, I used:
window.opener.document.all.textboxname.value
and
window.opener.__doPostBack('buttonname', '')

I made the javascript dynamic as well... here is the javascript I created
for the popup window

// register javascript
if(!Page.IsClientScriptBlockRegistered("fillAndClo se"))
{
string script = @"<script language=""javascript"">" + "\r\n";
script += "function fillAndClose(empid){\r\n";
script += "window.opener.document.all." +
Request.QueryString["textbox"] + ".value=empid;\r\n";
script += "window.opener.__doPostBack('" +
Request.QueryString["button"] + "','');\r\n";
script += "window.close();}\r\n";
script += "</script>\r\n";
this.Page.RegisterClientScriptBlock("fillAndClose" , script);
}

So, if I just pass in the name of the textbox and the name of the button in a querystring, the popup window will use those on the main form.

HTH,
-Cliff

"EMW" <SomeOne@MicroSoftdotCom> wrote in message
news:40**********************@dreader2.news.tiscal i.nl...
Hi,

Is it possible with VB.NET and Javascript to popup a window, after a
buttonclick, in which the user writes some text in a textbox and then when that window is closed with a button, the text is posted back to the aspx
program?

If it is possible, please let me know some articles about this?

thanks,
Eric


Nov 18 '05 #3
Eric,

You can popup a window with javascript call showModalDialog(...). You can
pass a url of a aspx page as a parameter. You will get a new window with a
fully functional webform inside. It can include all server- and client-side
components, perform postbacks, whatever you want. The calling window will
sit and wait until the popup closes. It will get back a parameter, which can
be the text you want to pass.

Eliyahu

"EMW" <SomeOne@MicroSoftdotCom> wrote in message
news:40**********************@dreader2.news.tiscal i.nl...
Hi,

Is it possible with VB.NET and Javascript to popup a window, after a
buttonclick, in which the user writes some text in a textbox and then when
that window is closed with a button, the text is posted back to the aspx
program?

If it is possible, please let me know some articles about this?

thanks,
Eric

Nov 18 '05 #4

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

Similar topics

12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
4
by: Andrew Alger | last post by:
ok i have two forms. Customer.aspx and Parent_Searh.aspx. There is a button on Customer.aspx that when executed runs javascript code to open up parent_search as a popup. After the user searches...
5
by: Jay | last post by:
I have a situation where the user clicks on a button in a DataGrid to launch a popup window via javascript. In the popup window the user does some things that result in changes to the underlying...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.