Solved

OnTextChanged event in javascript and asp.net

Posted on 2004-10-05
8
21,976 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
[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
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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
 
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

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

752 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