Showing posts with label child. Show all posts
Showing posts with label child. Show all posts

Thursday, March 29, 2012

Passing values from a child window

hi all,
I have a parent window default.aspx which has a textbox(txtBox1) with
multiline property and a button.when the button is clicked a child
window pops up child.aspx.
I have four textboxes in child.aspx and a submit button.What I want to
happen is when I click the submit button all the values must be
displayed in the multiline textbox in a table format with header and
the values below or any formatted display with headers.
I am using,
window.opener.documents.forms[0].txtBox1.value method to pass the
values.
can anybody help me to fix the values from the child window to the
parent window in a formatted display.I have been trying this for a day.
thanksHello ssrivani@.gmail.com,
From what I understood, after opening the child window and filling in the ch
ild form, you want to be able to:
1- Format the form field values in an html table.
2- copy the resulting html to the opening window and have it inserted into t
he multi line text field.
Try the attached files and see if it works for you.

> hi all,
>
> I have a parent window default.aspx which has a textbox(txtBox1) with
> multiline property and a button.when the button is clicked a child
> window pops up child.aspx.
> I have four textboxes in child.aspx and a submit button.What I want to
> happen is when I click the submit button all the values must be
> displayed in the multiline textbox in a table format with header and
> the values below or any formatted display with headers.
> I am using,
> window.opener.documents.forms[0].txtBox1.value method to pass the
> values.
> can anybody help me to fix the values from the child window to the
> parent window in a formatted display.I have been trying this for a
> day.
>
> thanks
>

passing values from chil pop up to parent

Hello Everyone,
I am trying to pass the value from my child window to my parent window. I
don't get the value from child to my parent when I refresh my parent page,
if I don't refresh my parent page then I get the value frtom my child window
.
Below is the code in my parent window and child page. I need to refresh my
parent page because once the page refreshes and the child window closes, I
want some method to execute
btnSubmit.Attributes.Add("onclick", "window.open('newForm.aspx' ,
'CustomPopUp','width=600, height=400, statusbar=no, menubar=no,
resizable=no') ");
txtName.Text = hdnPopResult.Value; // assigning hidden filed value to a text
filed on asp.net page
my child window
function passvalues()
{
var txtValue = document.getElementById("txtSubmit").value;if(txtValue !="")
{
window.opener.form1.hdnPopResult.value = txtValue;
opener.document.location.reload();
window.close();
}
}
btnSubmit.Attributes.Add("onclick", "passvalues()");
Any help will be apprecaited."Vinki" <Vinki@.discussions.microsoft.com> wrote in message
news:93A10F20-93D0-438B-9BC7-C012DEBAB555@.microsoft.com...

> I am trying to pass the value from my child window to my parent window. I
> don't get the value from child to my parent when I refresh my parent
> page,
> if I don't refresh my parent page then I get the value frtom my child
> window.
That's normal behaviour - think about it...
When you tell a page to reload, that's exactly what it will do i.e. it will
load in precisely the way that it loaded previously - it won't "remember"
the fact that it has been changed client-side *after* it was last loaded...

> I need to refresh my parent page because once the page refreshes and the
> child window closes, I want some method to execute
Is this method client-side or server-side?
Mark Rae
ASP.NET MVP
http://www.markrae.net
you should submit the parent instead of reload.:
window.opener.form1.hdnPopResult.value = txtValue;
window.opener.form1.submit();
-- bruce (sqlwork.com)
Vinki wrote:
> Hello Everyone,
> I am trying to pass the value from my child window to my parent window.
I
> don't get the value from child to my parent when I refresh my parent page
,
> if I don't refresh my parent page then I get the value frtom my child wind
ow.
> Below is the code in my parent window and child page. I need to refresh my
> parent page because once the page refreshes and the child window closes, I
> want some method to execute
> btnSubmit.Attributes.Add("onclick", "window.open('newForm.aspx' ,
> 'CustomPopUp','width=600, height=400, statusbar=no, menubar=no,
> resizable=no') ");
> txtName.Text = hdnPopResult.Value; // assigning hidden filed value to a te
xt
> filed on asp.net page
> my child window
> function passvalues()
> {
> var txtValue = document.getElementById("txtSubmit").value;if(txtValue !=""
)
> {
> window.opener.form1.hdnPopResult.value = txtValue;
> opener.document.location.reload();
> window.close();
>
> }
>
>
> }
> btnSubmit.Attributes.Add("onclick", "passvalues()");
> Any help will be apprecaited.
>
>
It is a server side code.
"Mark Rae [MVP]" wrote:

> "Vinki" <Vinki@.discussions.microsoft.com> wrote in message
> news:93A10F20-93D0-438B-9BC7-C012DEBAB555@.microsoft.com...
>
> That's normal behaviour - think about it...
> When you tell a page to reload, that's exactly what it will do i.e. it wil
l
> load in precisely the way that it loaded previously - it won't "remember"
> the fact that it has been changed client-side *after* it was last loaded..
.
>
> Is this method client-side or server-side?
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
"Vinki" <Vinki@.discussions.microsoft.com> wrote in message
news:EA7EA873-2502-48F0-A12A-A826F6854E4A@.microsoft.com...

> It is a server side code.
Bruce has already given you the correct answer...
Mark Rae
ASP.NET MVP
http://www.markrae.net

Monday, March 26, 2012

passing values to showmodal dialog

I have parent.aspx web page from which I call a modal dialog (child.aspx via
showmodaldialog). I'd like to populate two text boxes, <asp:TextBox id=txt
_HN> on the child form with data from the caller.
for parent.aspx....
<script> block
function UpdH(title,horse)
{
var iParms=new Object();
iParms.Name=horse;
...}
for child.aspx...
<script> block
I've tried "document.getElementById('txt_HN').value=iParms.Horse;" within ch
ild.aspx form - but get error "document.getElementbyId(...) is null or not a
n object". How do I do this?David,
Try dialogArguments.window.document.getElementById....
using the following to open your window in java script:
var TestWindow = new Object();
TestWindow.caller = window.showModalDialog(URLstr, window, sFeatures);
replacing the parameters there with whatever you use as appropriate.
Raymond Lewallen
"DavidS" <DavidS@.discussions.microsoft.com> wrote in message
news:564EE97A-8C7D-4E35-B034-99BB78A95904@.microsoft.com...
> I have parent.aspx web page from which I call a modal dialog (child.aspx
via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox
id=txt_HN> on the child form with data from the caller.
> for parent.aspx....
> <script> block
> function UpdH(title,horse)
> {
> var iParms=new Object();
> iParms.Name=horse;
> ...}
> for child.aspx...
> <script> block
> I've tried "document.getElementById('txt_HN').value=iParms.Horse;" within
child.aspx form - but get error "document.getElementbyId(...) is null or not
an object". How do I do this?

passing values to showmodal dialog

I have parent.aspx web page from which I call a modal dialog (child.aspx via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox id=txt_HN> on the child form with data from the caller.
for parent.aspx....
<script> block
function UpdH(title,horse)
{
var iParms=new Object();
iParms.Name=horse;
...}
for child.aspx...
<script> block
I've tried "document.getElementById('txt_HN').value=iParms.Hor se;" within child.aspx form - but get error "document.getElementbyId(...) is null or not an object". How do I do this?David,

Try dialogArguments.window.document.getElementById... .

using the following to open your window in javascript:

var TestWindow = new Object();
TestWindow.caller = window.showModalDialog(URLstr, window, sFeatures);

replacing the parameters there with whatever you use as appropriate.

Raymond Lewallen

"DavidS" <DavidS@.discussions.microsoft.com> wrote in message
news:564EE97A-8C7D-4E35-B034-99BB78A95904@.microsoft.com...
> I have parent.aspx web page from which I call a modal dialog (child.aspx
via showmodaldialog). I'd like to populate two text boxes, <asp:TextBox
id=txt_HN> on the child form with data from the caller.
> for parent.aspx....
> <script> block
> function UpdH(title,horse)
> {
> var iParms=new Object();
> iParms.Name=horse;
> ...}
> for child.aspx...
> <script> block
> I've tried "document.getElementById('txt_HN').value=iParms.Hor se;" within
child.aspx form - but get error "document.getElementbyId(...) is null or not
an object". How do I do this?

passing variable from child to parent - possible ?

I have a main form, and i have another form i need to call on a button
press,
then id like the result of the child form to pass data back to the parent -
without losing any data previously entered
on the parent - is this possible ? ( my main parent window is starting to
get quite cluttered)

cheers

markmark wrote:
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark

The problem is in not losing the "parent" data... Are these windows open
in the same browser window or are you opening the "child" in a new
window? If its the same just save their existing data, in a
db/viewstate/session/etc, and then when you reload it retrieve it.
If not you will have to force the "parent" to postback to get it to
refresh, and with the viewstate enabled you should get the pre-entered
data to remain

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Mark,

The standard way is to call javascript method showModalDialog for the child
form. The child form can pass back data in javascript window.returnValue
property which the parent form will get as a return value of the
showModalDialog call.

Eliyahu

"mark" <mark@.remove.com> wrote in message
news:1122386021.4716.0@.spandrell.news.uk.clara.net ...
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the
parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
Mark,

The standard way is to call javascript method showModalDialog for the child
form. The child form can pass back data in javascript window.returnValue
property which the parent form will get as a return value of the
showModalDialog call.

Eliyahu

"mark" <mark@.remove.com> wrote in message
news:1122386021.4716.0@.spandrell.news.uk.clara.net ...
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the
parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
> The problem is in not losing the "parent" data... Are these windows open
> in the same browser window or are you opening the "child" in a new
> window? If its the same just save their existing data, in a
> db/viewstate/session/etc, and then when you reload it retrieve it.
> If not you will have to force the "parent" to postback to get it to
> refresh, and with the viewstate enabled you should get the pre-entered
> data to remain
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com

looks like ill be forced to save on opening the child, either that i
redesign the whole form to be more modular
problem is - i have to pass an ID to the child that doesnt exist until the
parent is saved - so things are getting more complicated
than in reality they should be

cheers

mark
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:OvYQHtekFHA.1464@.TK2MSFTNGP14.phx.gbl...
> Mark,
> The standard way is to call javascript method showModalDialog for the
child
> form. The child form can pass back data in javascript window.returnValue
> property which the parent form will get as a return value of the
> showModalDialog call.
> Eliyahu
got any examples ?

thanks

mark
> The problem is in not losing the "parent" data... Are these windows open
> in the same browser window or are you opening the "child" in a new
> window? If its the same just save their existing data, in a
> db/viewstate/session/etc, and then when you reload it retrieve it.
> If not you will have to force the "parent" to postback to get it to
> refresh, and with the viewstate enabled you should get the pre-entered
> data to remain
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com

looks like ill be forced to save on opening the child, either that i
redesign the whole form to be more modular
problem is - i have to pass an ID to the child that doesnt exist until the
parent is saved - so things are getting more complicated
than in reality they should be

cheers

mark
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:OvYQHtekFHA.1464@.TK2MSFTNGP14.phx.gbl...
> Mark,
> The standard way is to call javascript method showModalDialog for the
child
> form. The child form can pass back data in javascript window.returnValue
> property which the parent form will get as a return value of the
> showModalDialog call.
> Eliyahu
got any examples ?

thanks

mark

passing variable from child to parent - possible ?

I have a main form, and i have another form i need to call on a button
press,
then id like the result of the child form to pass data back to the parent -
without losing any data previously entered
on the parent - is this possible ? ( my main parent window is starting to
get quite cluttered)

cheers

markmark wrote:
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark

The problem is in not losing the "parent" data... Are these windows open
in the same browser window or are you opening the "child" in a new
window? If its the same just save their existing data, in a
db/viewstate/session/etc, and then when you reload it retrieve it.
If not you will have to force the "parent" to postback to get it to
refresh, and with the viewstate enabled you should get the pre-entered
data to remain

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

passing variable from child to parent - possible ?

I have a main form, and i have another form i need to call on a button
press,
then id like the result of the child form to pass data back to the parent -
without losing any data previously entered
on the parent - is this possible ? ( my main parent window is starting to
get quite cluttered)
cheers
markmark wrote:
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the parent
-
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
>
The problem is in not losing the "parent" data... Are these windows open
in the same browser window or are you opening the "child" in a new
window? If its the same just save their existing data, in a
db/viewstate/session/etc, and then when you reload it retrieve it.
If not you will have to force the "parent" to postback to get it to
refresh, and with the viewstate enabled you should get the pre-entered
data to remain
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Mark,
The standard way is to call javascript method showModalDialog for the child
form. The child form can pass back data in javascript window.returnValue
property which the parent form will get as a return value of the
showModalDialog call.
Eliyahu
"mark" <mark@.remove.com> wrote in message
news:1122386021.4716.0@.spandrell.news.uk.clara.net...
> I have a main form, and i have another form i need to call on a button
> press,
> then id like the result of the child form to pass data back to the
parent -
> without losing any data previously entered
> on the parent - is this possible ? ( my main parent window is starting to
> get quite cluttered)
> cheers
> mark
>
> >
> The problem is in not losing the "parent" data... Are these windows open
> in the same browser window or are you opening the "child" in a new
> window? If its the same just save their existing data, in a
> db/viewstate/session/etc, and then when you reload it retrieve it.
> If not you will have to force the "parent" to postback to get it to
> refresh, and with the viewstate enabled you should get the pre-entered
> data to remain
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
looks like ill be forced to save on opening the child, either that i
redesign the whole form to be more modular
problem is - i have to pass an ID to the child that doesnt exist until the
parent is saved - so things are getting more complicated
than in reality they should be
cheers
mark
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:OvYQHtekFHA.1464@.TK2MSFTNGP14.phx.gbl...
> Mark,
> The standard way is to call javascript method showModalDialog for the
child
> form. The child form can pass back data in javascript window.returnValue
> property which the parent form will get as a return value of the
> showModalDialog call.
> Eliyahu
>
got any examples ?
thanks
mark