473,834 Members | 1,905 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 1302
> 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
3733
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
2396
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
1117
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
1765
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
4864
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
1184
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
2753
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
1613
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
9649
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
10224
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
9338
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
7761
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
6960
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
5629
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
4428
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
2
3985
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3084
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.