473,762 Members | 7,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble with Javascript when converting 2003 webproject to a 2005 project using Master Pages

Hi All,

We've got an VS.2003 ASPNET (VB) webproject which we would like to convert
to VS.2005 so that we can make use of the Master Page feature. Converting
the initial pages to 2005 is not such a problem (some minor errors) but we
run into trouble when we're trying to insert a converted page into a master
page content-placeholder.

The original page has some Javascript in it which ofcourse references to
controls in a form in the page. The form name is "frmContent ", the control
is "txtSubject ". In Javascript this is refered to as:
document.frmCon tent.txtSubject . However when this page is in the content of
a master page the frmContent form had vanished from the rendered page (view
source). Not only that: the txtSubject control is renamed to:
ctl00_phMasterC ontent_txtSubje ct. Obviously the existing Javascript will not
function anymore.

Another strange thing: suddenly there's a new <form> in the page which I
haven't created: aspnetForm. I think this is created by the master page but
I'm not sure.

Has anyone encountered the same problems that I'm facing and what's the most
simple solution? Rewriting all Javascript is going to be a lot of work..

TIA
Friso Wiskerke
Jan 12 '06 #1
1 1299
> Another strange thing: suddenly there's a new <form> in the page which I
haven't created: aspnetForm. I think this is created by the master page but
I'm not sure.
Yes, this will be the server-side form created by default in the master
page; all the content placeholders should fall within it so you can use
server controls within your Content blocks without putting a <form
runat="server"> on each individual page.
The original page has some Javascript in it which ofcourse references to
controls in a form in the page. The form name is "frmContent ", the control
is "txtSubject ".
If the form is server-side (runat="server" ), then it could create
problems, as you may usually only have one server-side form per page
(which the master has provided for you)...
However when this page is in the content of
a master page the frmContent form had vanished from the rendered page (view
source).
....so, you shouldn't need to have separate <form> elements in the
content-placeholder, and removing those tags may cause the contents to
render properly.
the txtSubject control is renamed to:
ctl00_phMasterC ontent_txtSubje ct. Obviously the existing Javascript will not
function anymore.


This "name mangling" is necessary to keep identifiers unique within
different parts of the page. You can work around it by substituting the
result of <% txtSubject.Clie ntID %> into the Javascript at the relevant
points in place of txtSubject, and the correct form name instead of
frmContent; however, this might be tedious if you have large amounts of
code that needs modifying in this way. You could possibly set up a
Javascript object called frmContent [and call the real form something
different] then add members to it with names corresponding to the
original names, pointing to the actual controls with mangled names
inserted as above.

Jan 12 '06 #2

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

Similar topics

2
3727
by: dotnetjose | last post by:
Hi Folks, My subject message pretty musch explains it. By Default the Form definition sits at the Master Page file. Is there a way I can access the setting from my Content Page that uses a Master Page? Thanks in advance.
8
2390
by: otto | last post by:
Hi, all: I have a problem with the inclusion of .js files in mu .aspx pages when using Master Pages. I try to explain it. If I make a web project without master pages I simply put in the head tag on each page the reference to the ..js file I want to use. Because I want client side includes I make the reference with <script> tag, for example: <head runat=server> <script src="/javascript/test.js" /> </head>
0
957
by: StanD | last post by:
Since last Dec I have been waiting for the update that will allow me to port my projects to 2005. I have installed the download, the available update to permit me to successfully do this. I have found that nothing has changed. The conversion process continues to ignore the 2003 project configuration and imports files and folders that are not part of the project, and attemps to build these components. Additionally, in Solution Explorer, ...
0
1116
by: Nemisis | last post by:
I am creating a asp.net 2.0 website that can be accessed via a PDA. On the page i have a file upload .net control, which works fine on its own. I can check the HasFile property and upload the file to the server. If i then change the page to use a MasterPage, the file upload control doesnt work!! It will allow me to choose a file, but when i try to upload it, the HasFile property is false instead of true. Has anyone else had this...
1
1761
by: Don | last post by:
I'm using master pages and have added some base functionality (public functions) into this class. I then create a new web form using the above as the master page. In the code of my new web form, I need to access the custom PEMs of the Master page (I've created). I find only two ways of doing this (both of which i find unnecessary replication of code) - Make use of MasterType directive (which I'd have to do manually for each and every...
3
4863
by: Edward Mitchell | last post by:
I am converting a project that uses DirectX and worked under VS.NET 2003. Now when I convert the project to .NET 2005, there are linker errors for _Xran and _Xlen as follows: dx9.lib(WinConsole.obj) : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " ... .... dx9.lib(WinConsole.obj) : error LNK2019: unresolved external symbol "public: void __thiscall...
0
1183
by: luminousc | last post by:
Hi guys, I've got a really annoying bug that I can't find a way around. I'm trying to rebuild our group's intranet. Which comprises of 4 individual companies, hence I want to use 4 different themes with skins. I really don't want to have to have 4 copies of the same master page just to get round the problem. The exact issue I'm having is this; in my app, when the user clicks
0
2752
by: dixonjm | last post by:
Hi, I have a master page & various pages that will use this master page. Each content page will have a CSS & JS file which will be named the same as the content page. When I try to load the CSS & JS files using the code behind of the content page, my buttons aren't rendered and Im not sure why? Here is the code for my content page - Properties.aspx:- <%@ Page Language="C#" AutoEventWireup="true" Title="Properties"...
1
1609
by: dixonjm | last post by:
Hi, I am trying to develop an error handling in our asp.net web app. I'm pretty new to Master pages although the concept of master pages had been completed by someone else & works fine. What I am trying to achieve is to have some code in the master page (I think this is where it will go) & this will need to handle any errors which occur in the content pages, I'm not quite sure what to do yet if there is an error in the BL or DAL? But, in...
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
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...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
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...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
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
6640
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
5266
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...
1
3913
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.