Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2007, 01:10 PM
Registered User
 
Join Date: Apr 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default document.element isn't working in aspx page SOLVED

Hi everyone,

I'm trying to get the value from a hidden form on an aspx page. I've tried using a barebone html page and it works just fine. However as soon as I copy it to an aspx page I get "document.element.frm is null or not an object" error.

onClick="window.document.links[1].href=document.innerfrm.elements['redirect'].value;"

I've had a look at the source generated by the aspx and the innerfrm is being generated and sent to the browser. For some reason javascript can't see it though.

Is there any special thing I need to do to access my form from .NET?
 
Old June 29th, 2007, 01:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. usually aspx renames every object in a diferent name, I'm not a js expert, but you can try functions like ones that get you the name of the control after rendered... control

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old June 29th, 2007, 01:44 PM
Registered User
 
Join Date: Apr 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by gbianchi
 hi there.. usually aspx renames every object in a diferent name, I'm not a js expert, but you can try functions like ones that get you the name of the control after rendered... control

HTH

Gonzalo
Hi Gonzalo,

Thanks for the reply. The object aren't ASP.NET control but encoded in the HTML directly so they are keeping their original names. I've tested this by viewing the HTML source of the generated document. It seems to me that it's related to the webform that aspx wrap everything in add an extra layer around each control. I can't get around it though...for now.

EDIT: Actually I solved my problem...it was related to the ASPX form being placed before my actual form so I would have needed to use:
document.Form1.innerfrm.elements but that wasn't an option as that logic is used for classic asp apps as well.

What I did is I wrapped everything in a user control and included it in the webform before the ASPX form tag. I don't think that will cause any problem as the content of the user control is static.





Similar Threads
Thread Thread Starter Forum Replies Last Post
WroxUnited not working with IIS Solved TieDyeGeek BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 October 13th, 2007 04:28 PM
SOLVED: How to recover element with eventutil.js javata BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 October 5th, 2006 03:50 AM
my aspx.net first page is not working Raz Muhammad .NET Web Services 2 March 7th, 2004 09:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.