Solved

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

Posted on 2010-11-15
1
1,028 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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 article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
Suggested Courses

636 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