Re: Trouble with Javascript when converting 2003 webproject to a 2005 project using Master Pages
- From: "Paul Henderson" <paulhenderson@xxxxxxxxxxxxxxxxxxxxx>
- Date: 12 Jan 2006 09:22:57 -0800
> 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_phMasterContent_txtSubject. 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.ClientID %> 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.
.
- References:
- Prev by Date: Re: Adding user to role in ASP.Net 2
- Next by Date: Re: Error - System.Data.OleDb.OleDbException: Could not use ''; file already in use. - please help
- Previous by thread: Trouble with Javascript when converting 2003 webproject to a 2005 project using Master Pages
- Next by thread: Re: How to specify the password for access database file while using AccessDataSource? <eom>
- Index(es):
Relevant Pages
|