473,397 Members | 2,068 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,397 software developers and data experts.

Javascript and Masterpages

I am using a popup Calendar to populate a textbox. When the textbox is on a
form without content control, it works fine. the script
is:<script>window.opener.document.forms(0).txtDate .value
='3/20/2006';self.close()</script>

However, when the textbox is within a content control, it does not work. I
changed the script to <script>window.opener.document.Content(0).txtDate. value
='3/13/2006';self.close()</script> still not working.
Mar 26 '06 #1
1 1219
Hi Mori,

Once you start using master pages and containers, the names of the controls
change dramatically. You need to use the name that ASP.NET gives the
control. You can get that by using the control's ClientID property.

At also means you need to create the JavaScript dynamically.

Here's the idea:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled
Page" %>

<script runat="server">

Protected Sub Page_Load _
(ByVal sender As Object, ByVal e As System.EventArgs)
Page.ClientScript.RegisterStartupScript _
(Me.GetType, "cal", "document.forms[0]." & _
txtDate.ClientID & ".value='3/20/2006';", True)
End Sub
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:textbox id="txtDate" runat="server"></asp:textbox>
</asp:Content>
Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

"Mori" <Mo**@discussions.microsoft.com> wrote in message
news:CD**********************************@microsof t.com...
I am using a popup Calendar to populate a textbox. When the textbox is on
a
form without content control, it works fine. the script
is:<script>window.opener.document.forms(0).txtDate .value
='3/20/2006';self.close()</script>

However, when the textbox is within a content control, it does not work.
I
changed the script to
<script>window.opener.document.Content(0).txtDate. value
='3/13/2006';self.close()</script> still not working.

Mar 27 '06 #2

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

Similar topics

1
by: Roger Walter | last post by:
When using the MasterPages form Templating from ASP.NET web Controls, and also using another templating process that uses User Controls, I get a border around the entire page when it is rendered...
1
by: nLella | last post by:
I am trying to build a new web application and trying to implement either templates or master pages in it. I tried to read several articles but could not actually deside on weather to go with the...
3
by: Lars W. Andersen | last post by:
Hi, I am looking for a good - easy to comprehend little CMS application for my "beginners" asp.net 2.0 site. It must be able to use Access as the database (only a couple of people will be...
1
by: michael.bollhoefer | last post by:
I was running into issues with the images on the page not working under sub folders. If you leave a master file in the root folder and place content pages in the subfolder then when you hit a...
2
by: iturner100 | last post by:
Hi, I've been struggling with this one for a couple of hours without much joy. Basically, I've got a set of nested masterpages (3 as it happens). I'm dynamically generating a new page in code...
5
by: Nick Wouters | last post by:
Dear All In Classic ASP I used CSS for ALL layout. Now in ASP.NET version 2 I am testing out Masterpages as they come in very handy. It seems like it is replacing CSS for layout but what is...
2
by: Dave Mathew | last post by:
I'm trying to run some clientside javascript on page load for one of my ASP.Net pages. I am using the ClientScript.RegisterClient....() methods to register an external javascript file within...
6
by: =?Utf-8?B?U3RlcGhlbiBIYXRmaWVsZA==?= | last post by:
I have two masterpages in a web application. One is used for the login and logout pages. The other is used for all other pages in the application. The difference between the two masterpages is...
8
by: Mort Strom | last post by:
Right now the header of my master page contains all of the CSS styles for all of the pages that might be loaded in my ContentPlaceHolder. The problem is that my <styletag is getting too large to...
2
Frinavale
by: Frinavale | last post by:
JavaScript in ASP.NET Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
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: 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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.