Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Problem Issue Error Upgrading To .Net Framework 4 Makes Form Elements Become Undefinded Or Unavailable

Upgrading To .Net Framework 4 Makes Form Elements Become Undefinded Or Unavailable

I’m working on a .Net web application project that run on IIS 7 with Application Pool on .Net Framework 2.0 and it’s working properly. After I upgrade the application pool to .Net Framework 4.0 version, all my form elements assigning or retrieving the value are stopped working. The form is generated dynamically in the code behind so I’m not sure how the >form< tag is built.

On .Net Framework 2.0, the form is rendered as below:

[text]<form name="frmProduct" action="Products.aspx" id="frmProduct">[/text]

And below is the way I use to assign the value of an element named “txtAmount”:

document.frmProduct.txtAmount.value = 10;

document.frmProduct.txtAmount.value = 10;

It’s working properly.

But on .Net Framework 4.0, the form doesn’t have the “name” property

<form action="Products.aspx" id="frmProduct">

<form action="Products.aspx" id="frmProduct">

When I test on Firefox, it shows error message in Error Console: “document.frmProduct is undefined” and it passes the script line: “document.frmProduct.txtAmount.value = 10;”.

To fix the form element becomes undefined issue, I have to use another way of assigning the value as below:

document.getElementById('txtAmount').value = 10;

document.getElementById('txtAmount').value = 10;

And it’s working again as dream 🙂

The way to fix it is really simple with experience Developer but I have to spend 2-3 hours to work it out as the form generation is in the code behind and all source codes have been complied to DLL already.

Anyway, It’s done now. Happy programming & debugging.

Jun 10, 2011Hoan Huynh
Difference Between cPanel and WHM (WebHost Manager)?Google Toolbal is disabled and disappeared on Firefox 5
You Might Also Like:
  • How To Track Website With Multiple Google Analytisc Accounts
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • Differences Between .NET Framework 4.0 And Earlier Releases
  • Disable Auto Save Password In HTML Form Or TextBox
  • Application pool ‘abc’ suffered a fatal communication error with the Windows Process Activation Service
  • innerText May Not Work On Mozilla Firefox
  • Get Image Width Height With JQuery And JavaScript
  • JavaScript Get Radio Button Value
  • Add WordPress Login Form On Sidebar Or Custom Page
  • Javascript Problem Set focus textbox on Firefox
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

11 years ago Problem Issue ErrorApplication Pool, Framework, getElementById, IIS 7196
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,550 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,886 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,740 views
JQuery Allow only numeric characters or only alphabet characters in textbox
15,063 views
C# Read Json From URL And Parse/Deserialize Json
11,795 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development