Solved

OnTextChanged event in javascript and asp.net

Posted on 2004-10-05
8
21,960 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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-…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

911 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

17 Experts available now in Live!

Get 1:1 Help Now