Solved

compilation error: asp.textbox = OnTextChanged="JavaScript function();

Posted on 2010-11-15
1
1,022 Views
Last Modified: 2012-05-10
Hello,
I am attempting to call a JavaScript function from a asp:textbox control. My code is as follows:
---------
 <asp:TextBox ID="txtTotal" runat="server" Width="100px" Enabled="false" OnTextChanged="RegTotal();"  ></asp:TextBox>
--------
When  this JavaScript function is called from an input control, it works. that code follows:
-----
<INPUT TYPE=TEXT NAME="Total" SIZE=12 onChange="RegTotal();" value="0" style="background-color:#FFFFBF;font-weight:bold;" />      

               <asp:HiddenField ID="hdnTotal"  runat="server"/>
------

how can i call  this javascript function from a asp: textbox control?
ANY help is greatly appreciated.
0
Comment
Question by:Codeaddict7423
1 Comment
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34138275
OnTextChanged is a server-side event. You want something like:

   <asp:TextBox ID="txtTotal" runat="server" Width="100px" Enabled="false" onchange="RegTotal();" />

Open in new window


The IDE might complain that it doesn't recognise it, but you can ignore it because it will simply copy the attribute to the output, which is what you want.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now