Solved

OnTextChanged event in javascript and asp.net

Posted on 2004-10-05
8
21,956 Views
Last Modified: 2011-08-18
I am using asp.Net with an Iframe.  I want to implement  OnTextChanged event in javascript.
Onclick from the span works, but  not OnTextChanged.  
I only want the confirm or alert when the content is actually changed. onclick does not do that.
Your Help is appreciated.

<span onclick="javascript:confirm('Data has Changed. Click Ok to continue');">
<asp:textbox id=txtNotes
tabIndex=2
runat="server"
Width="472px"
ForeColor="Blue"
ToolTip="Coments-Notes"
Columns="70" MaxLength="70"
Text='<%# DataBinder.Eval(DataView1, "[0].Notes") %>'
Height="100px" TextMode="MultiLine">
</asp:textbox>
</span>

Thanks,
0
Comment
Question by:externet
8 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 12227836
try onchange instead of ontextchanged
0
 
LVL 9

Expert Comment

by:riyasjef
ID: 12230430
Hi
You can implement "OnTextChanged " for the textbox itself..
why u are looking for "span"..I think it will not work..

<asp:textbox id=txtNotes
tabIndex=2
runat="server"
Width="472px"
ForeColor="Blue"
OnTextChanged="text_changed"
ToolTip="Coments-Notes"
Columns="70" MaxLength="70"
Text='<%# DataBinder.Eval(DataView1, "[0].Notes") %>'
Height="100px" TextMode="MultiLine">
</asp:textbox>

and in  C#

void text_changed()
{
   RegisterClientScriptBlock("id","alert('changed')");

}

Riyasjef
0
 

Author Comment

by:externet
ID: 12230851
Hello knightEknight!

onchange works the textbox how about the checkbox?
0
 

Author Comment

by:externet
ID: 12230955
Hello riyasjef,

OnTextChanged did not work using vb.net in my
asp.net page using the registerclient script block.
 
0
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.

 
LVL 11

Expert Comment

by:raj3060
ID: 12231987
onchange should work with checkbox, selectbox, radio, text
-Raj
0
 
LVL 25

Expert Comment

by:devic
ID: 12232351
probably, you are waiting direct event, and it fires only if you lost focus.

<input type=checkbox onchange=alert(this.checked)>


CLICK HERE, if the checkbox lost focus you get event onchange
else, you need use onclick event.
0
 
LVL 9

Expert Comment

by:riyasjef
ID: 12242040
Hi

change the fn

void text_changed()
{
   RegisterClientScriptBlock("id","alert('changed')");

}

to

function text_changed()
{
   RegisterClientScriptBlock("id","<script>alert('changed')</script>");
}

Enter the "text" and press enter ..

Riyasjef

0
 

Author Comment

by:externet
ID: 12253093
I would like knightEknight   to have 400 points and  100 points to Riyasjef.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
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…

744 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

15 Experts available now in Live!

Get 1:1 Help Now