473,323 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

how to get the reference of the form in ascx

Hi!!!!!!!
I have aspx page which uses ascx(usercontrol) in it.
The ascx in turn contains a textbox and a button. if i click
the button, javascript code get executed to open another popup window,
in that code i am passing the form name , control name of the text
box. After few operations are performed in that popup window, when i
try to close the popup window, i am setting the value of the texbox in
ascx from the popup window using javascript

window.opener.document.forms["<%= strFormName %>"].elements["<%=
strCtrlName %
"].value = "<%= strSelectedDate %>";


it's giving me the error as
window.open.document.forms["abc"].txtbox.value is null or not an
object,

From the above error, I think the reference is lost to the form.

It works fine when I am not using any ascx(usercontrol) in my aspx
page and opening directly popup window from the aspx page.

Can someone help me out in this!!!!!!!!!!!!!!!!!

thanks
dharani
Nov 17 '05 #1
1 2058
Pattabi,

Have you placed form tags inside of your user control?

Asp.Net breaks if there is more than one set of form tags on a page. So you
aren't supposed to create a page, and then add a usercontrol with form tags
to it.

If indeed your user control does have form tags in it, remove them and then
just refer to the form as:

window.opener.document.Form1

You shouldn't even need to track the form name if you just stick with the
default form id that .Net assigns.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Pattabi" <dp******@saipeople.com> wrote in message
news:c0**************************@posting.google.c om...
Hi!!!!!!!
I have aspx page which uses ascx(usercontrol) in it.
The ascx in turn contains a textbox and a button. if i click
the button, javascript code get executed to open another popup window,
in that code i am passing the form name , control name of the text
box. After few operations are performed in that popup window, when i
try to close the popup window, i am setting the value of the texbox in
ascx from the popup window using javascript

window.opener.document.forms["<%= strFormName %>"].elements["<%=
strCtrlName %
"].value = "<%= strSelectedDate %>";


it's giving me the error as
window.open.document.forms["abc"].txtbox.value is null or not an
object,

From the above error, I think the reference is lost to the form.

It works fine when I am not using any ascx(usercontrol) in my aspx
page and opening directly popup window from the aspx page.

Can someone help me out in this!!!!!!!!!!!!!!!!!

thanks
dharani

Nov 17 '05 #2

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

Similar topics

0
by: dh | last post by:
As a simple example, I can't seem to be able to reference a label called "lblOutput" that exists in my test.aspx page from within a User control, TestControl.ascx. I am stumped. Any help is...
1
by: | last post by:
hi, can some one tell me snip code to get reference to web user controle (.ascx form) aspx "table" and its rows & cells. regards Sam.
1
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
4
by: Moe Sizlak | last post by:
Hi There, I have a user control that has 2 listmenus populated from a database, I want the form to submit when the listmenu are changed which seems to happen no problem when the page is on it's...
9
by: Moe Sizlak | last post by:
Hi There, I am trying to write the selected value of a listcontrol when a button is clicked and I keep getting the error "object not set to a reference of an object". The libox itself is in a...
6
by: blash | last post by:
Can someone help me? I really don't have a clue. My company staff told me they often got such error: "Object reference not set to an instance of an object." when they are in search result page...
7
by: Samuel | last post by:
Hi, I am building a page that makes use of user control as a templating technique. The following is that I have in mind and it is actually working: Root/ -- login.aspx -- login.aspx.vb --...
2
by: o0JoeCool0o | last post by:
I am trying to create a User Control, that will be a message box with input options if I call okconf.visible = true in the page load of the user control it works fine, but if i then try to call...
2
by: Dave Alessi | last post by:
I migrated my project from VS 2003 to VS 2005. The application runs ok with a few exceptions, one being an ambigoius reference when loading a form. My application uses its own "master page"...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
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...
0
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....
0
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 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.