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

[ASP.NET2.0] How to invoke a javascript inside layouttemplate

121 100+
I created a customed layout template in which contains a TextBox and Button.
Expand|Select|Wrap|Line Numbers
  1. <layouttemplate>
  2.     <asp:TextBox id="TxtUser" runat="server" />
  3.     <asp:Button id="myButton" runat="server" OnClientClick="myJavascriptFunction" />
  4. </layouttemplate>
The javascript looks like this:
Expand|Select|Wrap|Line Numbers
  1. <script type=text/javascript>
  2. function myJavascriptFunction ( )
  3. {
  4. var myVar = document.getElementById("<%= TxtUser.ClientID%>").value ;
  5.  
  6. ...code goes on
  7. }
  8. </script>
But no matter where I put my javascript file, this script would always generate an error : Cannot find reference "TxtUser" in context.

My code works fine if I remove the layouttemplate, it just seems that the "TxtUser" id is "hidden" by the layouttemplate.

Can anyone help me? Thanks in advance!
Mar 30 '08 #1
0 782

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hardy Wang | last post by:
Hi all, I have a login control, like below <asp:Login ID="loginPanel" runat="server" BorderPadding="0" PasswordRecoveryText="Click to retrieve your password" TitleText="Enter Your Username &...
4
by: InnoCreate | last post by:
Hi everyone, I've developed a couple of asp.net1.1 websites and these are viewable using my mobile phone. I've now moved over to asp.net2 and i'm unable to view asp.net2 websites on my phone. I've...
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
9
by: dreamamit2001 | last post by:
Hi, I am new user to ASP.NET2.0? I would like to know can Macintosh users able to access ASP.NET 2.0 site ? I also want to know what are the features of ASP.NET2.0 which are not supported for...
4
by: dreamamit2001 | last post by:
Hi, I would like to know the ASP.NET2.0's(Controls, Menubar, Validations, Object Data Souce Controls, Treeview Control) compatibility with IE5.0 browser on Mac OS. If I don't use Client side...
0
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and...
7
by: =?Utf-8?B?U3R1?= | last post by:
I have a ASP.NET Ajax app (using client library) calling ASP.NET Ajax-enabled web services. We are making use of the javascript proxies generated by ASP.NET Ajax. The problem we have is that the...
1
by: anilkumar1980 | last post by:
Hi All, Here I need help to all of u, I am using ASP.NET 2.0 and Third party Infragistic Controls. I Have included master page in my page (<%@ Page Language="VB"...
2
by: Jimmy B | last post by:
Hello, Does new ListView Control in .NET 3.5 support directly fixed headers, anyone tested yet? Cheers
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.