Solved

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

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

762 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

20 Experts available now in Live!

Get 1:1 Help Now