im playing around with showmodeldialog, and the child window isnt returning
the variable to the parent
in the parent i have
Button2.Attributes.Add("onclick", "var strReturn;
strReturn=window.showModalDialog('test.aspx',null, 'status:no;dialogWidth:370px;dialogHeight:220px;di alogHide:true;help:no;scroll:no');if
(strReturn != null) document.getElementById('Label45').value=strReturn ;")
child window has
Button1.Attributes.Add("onclick", "window.returnValue =
document.getElementById('TextBox1').value; window.close();")
if im correct - it should pass contents of TextBox1 to the parent and the
parent should show Label45 as the passed back variable - except it does
nothing ?
i feel like im on the right track somewhere!
cheers
Mark 10 1632
Mark,
The code looks fine. The problem is likely somewhere else.
Eliyahu
"luna" <lu**@themoon.com> wrote in message
news:lZ*******************@newsfe2-win.ntli.net... im playing around with showmodeldialog, and the child window isnt returning the variable to the parent
in the parent i have
Button2.Attributes.Add("onclick", "var strReturn; strReturn=window.showModalDialog('test.aspx',null, 'status:no;dialogWidth:370px;dialogHeight:220px;di alogHide:true;help:no;scroll:no');if (strReturn != null) document.getElementById('Label45').value=strReturn ;")
child window has
Button1.Attributes.Add("onclick", "window.returnValue = document.getElementById('TextBox1').value; window.close();")
if im correct - it should pass contents of TextBox1 to the parent and the parent should show Label45 as the passed back variable - except it does nothing ?
i feel like im on the right track somewhere!
cheers
Mark
im not sure where
both attributes.add statements are on page load,
child has <base target="_self"> between <head> </head>
otherwise another window pops up
am i correct in saying the variable should appear on the parent once ive
clicked the button on the child ?
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:O1**************@TK2MSFTNGP11.phx.gbl... Mark,
The code looks fine. The problem is likely somewhere else.
Eliyahu
"luna" <lu**@themoon.com> wrote in message news:lZ*******************@newsfe2-win.ntli.net... im playing around with showmodeldialog, and the child window isnt returning the variable to the parent
in the parent i have
Button2.Attributes.Add("onclick", "var strReturn; strReturn=window.showModalDialog('test.aspx',null, 'status:no;dialogWidth:370px;dialogHeight:220px;di alogHide:true;help:no;scroll:no');if (strReturn != null) document.getElementById('Label45').value=strReturn ;")
child window has
Button1.Attributes.Add("onclick", "window.returnValue = document.getElementById('TextBox1').value; window.close();")
if im correct - it should pass contents of TextBox1 to the parent and the parent should show Label45 as the passed back variable - except it does nothing ?
i feel like im on the right track somewhere!
cheers
Mark
What is the type of Label45?
If it is an asp:Label, it renders as a <span>. To change its text on client
side you should assign to
document.getElementById('Label45').innerText
Eliyahu
"luna" <lu**@themoon.com> wrote in message
news:Gx****************@newsfe3-win.ntli.net... im not sure where
both attributes.add statements are on page load,
child has <base target="_self"> between <head> </head>
otherwise another window pops up
am i correct in saying the variable should appear on the parent once ive clicked the button on the child ?
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:O1**************@TK2MSFTNGP11.phx.gbl... Mark,
The code looks fine. The problem is likely somewhere else.
Eliyahu
"luna" <lu**@themoon.com> wrote in message news:lZ*******************@newsfe2-win.ntli.net... im playing around with showmodeldialog, and the child window isnt returning the variable to the parent
in the parent i have
Button2.Attributes.Add("onclick", "var strReturn; strReturn=window.showModalDialog('test.aspx',null, 'status:no;dialogWidth:370px;dialogHeight:220px;di alogHide:true;help:no;scroll:no');if (strReturn != null) document.getElementById('Label45').value=strReturn ;")
child window has
Button1.Attributes.Add("onclick", "window.returnValue = document.getElementById('TextBox1').value; window.close();")
if im correct - it should pass contents of TextBox1 to the parent and the parent should show Label45 as the passed back variable - except it does nothing ?
i feel like im on the right track somewhere!
cheers
Mark
that did the trick thanks,
BUT
its sending the string back, the label changes, then it quickly changes back
to what it was
(blank) - what causes this ?
Likely a postback takes place. The server code knows nothing about the new
value and restores the label to previous blank one.
If you need to persist the value between the postbacks, you should pass it
on to the server in a hidden <input> control. Alternatively you can you a
textbox instead of a label.
Eliyahu
"luna" <lu**@themoon.com> wrote in message
news:Gu*****************@newsfe7-win.ntli.net... that did the trick thanks,
BUT
its sending the string back, the label changes, then it quickly changes back to what it was
(blank) - what causes this ?
works great with a textbox, thanks , how come it doesnt work with labels ?
is it the innerText fucntion causing the issue? i can work with the textbox
tho i think
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:ej***************@TK2MSFTNGP12.phx.gbl... Likely a postback takes place. The server code knows nothing about the new value and restores the label to previous blank one.
If you need to persist the value between the postbacks, you should pass it on to the server in a hidden <input> control. Alternatively you can you a textbox instead of a label.
Eliyahu
"luna" <lu**@themoon.com> wrote in message news:Gu*****************@newsfe7-win.ntli.net... that did the trick thanks,
BUT
its sending the string back, the label changes, then it quickly changes back to what it was
(blank) - what causes this ?
Hi,
Eliyahu Goldin wrote: What is the type of Label45?
If it is an asp:Label, it renders as a <span>. To change its text on client side you should assign to
document.getElementById('Label45').innerText
Eliyahu
Why not rather use a standard attribute, with:
document.getElementById( "Label45" ).firstChild.nodeValue
This way, the code will work in both IE and Firefox (about 15% of market
share ;-)
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
"Laurent Bugnion" <lb******@bluewin.ch> wrote in message
news:43********@news.bluewin.ch... Hi,
Eliyahu Goldin wrote: What is the type of Label45?
If it is an asp:Label, it renders as a <span>. To change its text on client side you should assign to
document.getElementById('Label45').innerText
Eliyahu
Why not rather use a standard attribute, with:
document.getElementById( "Label45" ).firstChild.nodeValue
This way, the code will work in both IE and Firefox (about 15% of market share ;-)
that work on postback tho ?, browser isnt important, as its an internal app,
all users use ie6
cheers
mark
Hi,
luna wrote: that work on postback tho ?,
The code I gave you is pure client-side. Client-side JavaScript doesn't
have a mechanism to preserve a "control"'s state over a postback.
Setting "innerText" also doesn't, and additionally it doesn't work in
Firefox.
browser isnt important, as its an internal app, all users use ie6
That's not an excuse for coding against standards in my opinion. cheers
mark
HTH
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
The short answer is that the Label control is not designed for passing
values back to server whereas the Textbox is.
Eliyahu
"luna" <lu**@themoon.com> wrote in message
news:55******************@newsfe6-win.ntli.net... works great with a textbox, thanks , how come it doesnt work with labels ? is it the innerText fucntion causing the issue? i can work with the textbox tho i think
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:ej***************@TK2MSFTNGP12.phx.gbl... Likely a postback takes place. The server code knows nothing about the new value and restores the label to previous blank one.
If you need to persist the value between the postbacks, you should pass it on to the server in a hidden <input> control. Alternatively you can you a textbox instead of a label.
Eliyahu
"luna" <lu**@themoon.com> wrote in message news:Gu*****************@newsfe7-win.ntli.net... that did the trick thanks,
BUT
its sending the string back, the label changes, then it quickly changes back to what it was
(blank) - what causes this ?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Simon Storr |
last post by:
Is it possible to make the parent window refresh when a modal dialog is
closed? I know I can use
window.opener.location.reload(true);
for a 'normal' window, but this doesn't work for...
|
by: Scott Lee |
last post by:
I am displaying an ASP.Net generated form in a popup opened with
window.showModalDialog.
The form contains DropDownList controls. The first ddl is populated via
databinding to a datatable, has...
|
by: Chris |
last post by:
I'm trying to use the showModalDialog window opener and for some reason even
though I have these set to no (an dI've tried 0 and false) the window still
shows them. Why? The window opens ok. I see...
|
by: MW de Jager |
last post by:
I want to call ShowModalDialog(...) from my C# code in the code behind page
of my aspx page. I do not want to link this to a button, since I want to
first do some checking myself before I call the...
|
by: johkar |
last post by:
Just want a verification of logic. This seems to work for IE and
Firefox, but I wonder if it would be a problematic test in any of the
other latest browsers? Is the use of the "window" object...
|
by: Satya |
last post by:
Hello,
I am using ShowModalDialog to display modal dialog in our
application. I am displaying modal dialog (WebForm1.aspx -
DropdownList's ,TextBox's and Ok and Cancel buttons placed on it) from...
|
by: David |
last post by:
Hi all,
I am opening a webform with showModalDialog. This appears to pop-up fine,
though I have a problem...
Inside the webform is a treeview control.
When the treeview is populated, I am...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |