473,324 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Master Pages and Javascript

Hi,

I'm trying to convert my normal ASP.NET site to one which uses master
pages. I have a separate js file which sets a HTML control on the form
as follows:-

form1.ctllname.value = mainDiv.HTML;

Of course the form does not exist anymore in this file as it is now as
asp:content page and I get the wrror message:-

'form1 is undefined'

How can I set this same control in the new context?

Seems straight forward but I can't crack it.
Thanks,
MonkeyBoy

Apr 21 '07 #1
3 3361
On 21 Apr, 16:21, Monk...@gmail.com wrote:
Hi,

I'm trying to convert my normal ASP.NET site to one which uses master
pages. I have a separate js file which sets a HTML control on the form
as follows:-

form1.ctllname.value = mainDiv.HTML;

Of course the form does not exist anymore in this file as it is now as
asp:content page and I get the wrror message:-

'form1 is undefined'

How can I set this same control in the new context?

Seems straight forward but I can't crack it.

Thanks,
MonkeyBoy
Having been thinking about this on the wrong level for sometime I
finally came to my senses (tip: take breaks). You just need to do a
getElementById as normal.

var ctllname= document.getElementById("ctllname");
ctllname.value = mainDiv.HTML;

Cheers,
MonkeyBoy

Apr 21 '07 #2
<Mo*****@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
Hi,

I'm trying to convert my normal ASP.NET site to one which uses master
pages. I have a separate js file which sets a HTML control on the form
as follows:-

form1.ctllname.value = mainDiv.HTML;

Of course the form does not exist anymore in this file as it is now as
asp:content page and I get the wrror message:-

'form1 is undefined'

How can I set this same control in the new context?

Seems straight forward but I can't crack it.

When your page is loaded, do a View Source and see how the various objects
have been renamed...

Then, maybe try something like this:

<script type="text/javascript">
document.getElementById('<%=ctlname.ClientID%>').v alue = mainDiv.HTML;
</script>
Apr 21 '07 #3
On 21 Apr, 16:40, "Mark Rae" <m...@markNOSPAMrae.netwrote:
<Monk...@gmail.comwrote in message

news:11**********************@d57g2000hsg.googlegr oups.com...


Hi,
I'm trying to convert my normal ASP.NET site to one which uses master
pages. I have a separate js file which sets a HTML control on the form
as follows:-
form1.ctllname.value = mainDiv.HTML;
Of course the form does not exist anymore in this file as it is now as
asp:content page and I get the wrror message:-
'form1 is undefined'
How can I set this same control in the new context?
Seems straight forward but I can't crack it.

When your page is loaded, do a View Source and see how the various objects
have been renamed...

Then, maybe try something like this:

<script type="text/javascript">
document.getElementById('<%=ctlname.ClientID%>').v alue = mainDiv.HTML;
</script>- Hide quoted text -

- Show quoted text -
Thanks Mark, I got it working using my version above. Cheers!

Apr 22 '07 #4

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

Similar topics

1
by: Alan Silver | last post by:
Hello, I am just converting some pages to use master pages, and I have come across a bit of a problem. One of the pages uses some custom Javascript functions for client-side validation. Now,...
1
by: Friso Wiskerke | last post by:
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...
8
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...
1
by: anony | last post by:
Hello, I'm converting a 1.1 app to 2.0 and decided to try out master pages. My menu system consists of images with onmouseover/out events to highlight selected menu items, and to display...
4
by: Greg | last post by:
I'm guessing the problem I'm having has something to do with Master Pages or DetailsView because the exact same code works fine on a page without a Master Page and DetailsView controls. The...
9
by: Andy | last post by:
Hey all, I'm building out my first project using asp.net v2.0 master pages. It seems that when you use master pages and try to reference document.body.scrollTop it allways = zero/0. The same code...
17
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
11
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses master pages. I have some pages that must not be cached on the client. In ASP.NET 1.1 I achieved this using metatags: <meta...
17
by: MeerkatInFrance | last post by:
There comes a time when you know you are not going to be able to work something out yourself, however hard you try. I have reached that moment. I have a master page and a slave page (or whatever...
3
by: JJ | last post by:
I am trying to convert applications built with .net framework 1.1 to use master pages. On a couple of aspx pages, I call certain javascript functions <body onresize="blah()"....> However, now...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.