473,382 Members | 1,368 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,382 software developers and data experts.

.NET 2.0 Master Pages and ClientScript

Howdy.

First of all, awesome job on .NET 2.0! Now to my question:

I love Master Pages and the Page.ClientScript; however, I am having trouble
getting the two to play together. I can build a simple .aspx page (no master
page) and add in JavaScript with RegisterClientScriptBlock() with no
problems. However, when I move the same code over to a content page (or a
master page), the client script is not added to the page. Are there other
steps required to get the two to play together? Is this working as intended,
or am I a moron? The code I'm using is simple:

string myScript = @"function doThis() { alert('Hello, World!');} doThis();
";

Page.ClientScript.RegisterClientScriptBlock(this.G etType(), "myscript",
myScript, true);

Thanks!
Nov 19 '05 #1
1 2401
It seems I'm a moron. I didn't have a form in my page. Duh!
"Jeremy McPeak" <jw******@gmail.com> wrote in message
news:un****************@TK2MSFTNGP09.phx.gbl...
Howdy.

First of all, awesome job on .NET 2.0! Now to my question:

I love Master Pages and the Page.ClientScript; however, I am having
trouble getting the two to play together. I can build a simple .aspx page
(no master page) and add in JavaScript with RegisterClientScriptBlock()
with no problems. However, when I move the same code over to a content
page (or a master page), the client script is not added to the page. Are
there other steps required to get the two to play together? Is this
working as intended, or am I a moron? The code I'm using is simple:

string myScript = @"function doThis() { alert('Hello, World!');} doThis();
";

Page.ClientScript.RegisterClientScriptBlock(this.G etType(), "myscript",
myScript, true);

Thanks!

Nov 19 '05 #2

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

Similar topics

5
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the...
20
by: Alan Silver | last post by:
Hello, In classic ASP, I used to use two include files on each page, one before and one after the main content, to provide a consistent layout across a web site. That way I could just change the...
8
by: Flip | last post by:
I have a website that's using Master pages (very cool). But when I put JS on there (to close the browser for example) coming from an external file, when I navigate away from the first page, the JS...
1
by: kfc1976 | last post by:
Hello All and Advanced Thanks For Replying, OS: XP Pro IDE: Visual Studio 2005 ..net Framework: 2.0..... Problem: Getting An Error When trying to implement the following CallBack on a content...
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...
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...
5
by: Sekhar | last post by:
Hi all I have a MasterPage and a Content Page. I want to raise a client side event for a control on my Content page When I place the javascript code in master page file it works fine. But when...
3
by: Rich | last post by:
Hi, I want to use 2 master pages, one for the main part of the site, the other for the admin pages. They are quite similar, with many shared elements. Ideally I would like to have a parent...
3
by: Adi | last post by:
Hi all, I have a menu which is placed in the master page. Now when the user clicks on one of the menu item, it fires an event which is handled in the master page. I need to know from which page...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.