473,655 Members | 3,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

modal form javascript can't find server control in opener to paste

I have a web form “Form1” with a panel. Inside the panel is a datalist. One
of the items displays the field value “xyz” from the dataset. If the field
is null the user clicks on a javascript to let him pick a value for the field
from a popup modal window.

<td><a href="javascrip t:GetNet()"> <img src="”> </a>VPN Network:</td>

<% if (XYZ !=""){%>
<td><asp:TextBo x id="txtXYZ" runat="server" Text='<%#
DataBinder.Eval (Container.Data Item, "XYZ") %>'></asp:TextBox>
<%}else{%>
<input type="text" runat=server id="XYZ">
<%}%></td>

The javascript on modal form tries to put a value selected back into
form1.XYZ with

function pasteNet(lstr)
{
window.opener.d ocument.forms["Form1"].elements["XYZ"].value = lstr;
window.close();
}
I get the error

Microsoft JScript runtime error:
'window.opener. document.forms. Form1.elements. vpnnet' is null or not an object

Is the syntax for identifying the server control input box incorrect? Does
it have to do with the input box being nested in the “if statement”. If I
use an html input box it works fine, the problem I need to attach code to the
input box so server control.

Please help
cindy
Nov 19 '05 #1
3 5394
Cindy,

I like using document.getEle mentById('[ElementName]') to find page items via
javascript.

Try:

function pasteNet(lstr)
{
window.opener.d ocument.getElem entById('XYZ'). value = lstr;
window.close();
}

If that doesn't work you may need to check how you're referring to
window.opener.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"cindy" <cm****@nospam. nospam> wrote in message
news:86******** *************** ***********@mic rosoft.com...
I have a web form "Form1" with a panel. Inside the panel is a datalist.
One
of the items displays the field value "xyz" from the dataset. If the
field
is null the user clicks on a javascript to let him pick a value for the
field
from a popup modal window.

<td><a href="javascrip t:GetNet()"> <img src=""> </a>VPN Network:</td>

<% if (XYZ !=""){%>
<td><asp:TextBo x id="txtXYZ" runat="server" Text='<%#
DataBinder.Eval (Container.Data Item, "XYZ") %>'></asp:TextBox>
<%}else{%>
<input type="text" runat=server id="XYZ">
<%}%></td>

The javascript on modal form tries to put a value selected back into
form1.XYZ with

function pasteNet(lstr)
{
window.opener.d ocument.forms["Form1"].elements["XYZ"].value = lstr;
window.close();
}
I get the error

Microsoft JScript runtime error:
'window.opener. document.forms. Form1.elements. vpnnet' is null or not an
object

Is the syntax for identifying the server control input box incorrect?
Does
it have to do with the input box being nested in the "if statement". If I
use an html input box it works fine, the problem I need to attach code to
the
input box so server control.

Please help
cindy

Nov 19 '05 #2
the best way to start debugging this is to view source HTML and check
if the control exists with the name you are trying to refer ..

Also following may help..

it would be easier to use the 'returnValue' from modal window,when you
need to return only 1 value

open modal window like
var str = window.showModa lDialog(" ....
if (str != "")
window.opener.d ocument.forms["Form1"].elements["XYZ"].value = str
Assign window.returnVa lue = lstr from the popup

Nov 19 '05 #3
if the textbox is a child of another control (say a repeater), then its
rendered name and id will have the parents prepended with a seperator. you
can use the ClientId property to get the fully qualified id, but the name is
not supported.
-- bruce (sqlwork.com)
"cindy" <cm****@nospam. nospam> wrote in message
news:86******** *************** ***********@mic rosoft.com...
I have a web form "Form1" with a panel. Inside the panel is a datalist.
One
of the items displays the field value "xyz" from the dataset. If the
field
is null the user clicks on a javascript to let him pick a value for the
field
from a popup modal window.

<td><a href="javascrip t:GetNet()"> <img src=""> </a>VPN Network:</td>

<% if (XYZ !=""){%>
<td><asp:TextBo x id="txtXYZ" runat="server" Text='<%#
DataBinder.Eval (Container.Data Item, "XYZ") %>'></asp:TextBox>
<%}else{%>
<input type="text" runat=server id="XYZ">
<%}%></td>

The javascript on modal form tries to put a value selected back into
form1.XYZ with

function pasteNet(lstr)
{
window.opener.d ocument.forms["Form1"].elements["XYZ"].value = lstr;
window.close();
}
I get the error

Microsoft JScript runtime error:
'window.opener. document.forms. Form1.elements. vpnnet' is null or not an
object

Is the syntax for identifying the server control input box incorrect?
Does
it have to do with the input box being nested in the "if statement". If I
use an html input box it works fine, the problem I need to attach code to
the
input box so server control.

Please help
cindy

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6513
by: Matt | last post by:
I reposted this question because I really want to accomplish this task. Please advise!! I want to post the form data (http://server/page1.asp) to a modal dialog window (http://server/modaldialog.asp) with a desired height 200px by width 200px. Here's my attempts and problems:
1
2729
by: William Starr Moake | last post by:
The browser-based WYSIWYG editor I'm developing has a popup window with a form that generates table code from user input (width, border, cols, rows, bgcolor.) But the user has to copy-paste the generated table HTML into the editor window as it works now. How do I pass the form-generated HTML directly to the editor window so copy-paste is not necessary? I know I have to set focus on the editor window in the generate table code function, but...
1
6104
by: stellabein | last post by:
Hi friends, I am very very new to programing. i have a one main window from that window i am opening one modal window using showmodaldialog(m.jp...). in that modal window i have a form. when i click save button in the form, the for has to submit and the modal window has to close. and the parent window have to refresh itself. this is my modal window page.
4
1497
by: Brian Henry | last post by:
(please dont say don't do this because SP2 will block this, this is an internal site and i have full access to settings on the domain to make popup blocking turned off for this site) i have a modal dialog box, which lets users select user names from a list (kinda like an address book) but then i need to return that list to the calling application form... how would i go about doing this? thanks!
8
2905
by: tshad | last post by:
I am using Andy Smiths Dialog windows, which work really well. My only problem is I am trying to make the Dialogs Modal. Someone mentioned putting <base target="_self"> into the head section of the modal window to make it work. I tried putting it both pages just to see if it would work and it doesn't seem to work. Does anyone know how to make these modal?
4
5510
by: Hitesh | last post by:
Hi, I am opening an Modal dialog box using the window.Showmodaldialogbox(), and in that window i am having an aspx form with say one ASP.NET Button control. i am doing some operation on the click event of the button control on the server and finally closing the window by using the following statement at the end of the click event of the button: Response.Write("<script language='javascript'>window.close();</script>"); But instead of...
2
3680
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the dialog. To be more specific I want to have a confirmation dialog that is shown when a user clicks on a Delete button (which deletes some values from database). If Yes is pressed the delete action is processed otherwise modal dialog is closed.
0
2057
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
1
9401
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
0
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8598
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.