473,396 Members | 1,804 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,396 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 4529
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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...
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...
0
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,...

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.