467,903 Members | 1,781 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,903 developers. It's quick & easy.

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
  • viewed: 4177
Share:
3 Replies
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by HarveyB | last post: by
4 posts views Thread by Andrew Alger | last post: by
12 posts views Thread by HarveyB | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.