Showing posts with label dialog. Show all posts
Showing posts with label dialog. Show all posts

Thursday, March 29, 2012

Passing values between 2 open pages (eg. parent and dialog)

Can someone tell me if there is another way of passing variables back and forth between 2 open pages (such as in the case of a dialog window) without using javascript.

I have done it before using javascript but now that I am using a lot of user controls on my pages I find it a pain in the butt with how the user controls are being named, especially when you have multiple nested controls.

Any help would be greatly appreciated.
Thanks.You could use session variables, but this would require that each of the pages involved do a postback in order to be able to read the session variables. Otherwise, javascript is your best bet.
Alright, thanks mendhak, just thought I would check to see if there was a better way.

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?