Solved

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

Posted on 2010-11-15
1
1,026 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

739 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