Can I use OnTextChanged in JavaScript for TextBox


    Sponsored Links


  • 1. Interfacing JavaScript and VBScript in an ASP.NET web form
    I have a small problem with my ASP.NET web form. I have a dropdownlist that is populated using client-side JavaScript, and when the page does an auto postback the list items in the dropdownlist are cleared. Is there a way that I can somehow lock the list items? Thank you.
  • 2. Accessing an embedded UserControl "<object" in javascript
    Hi I'm trying to set a property on a UserControl that I've embedded in my ASP.NET web page. At first, I had the following in the <form> section: <object id="mediaclient" classid="mediaclient.dll#NeuralFramework.MediaBroker.MediaClient"></object> When I tried to use custom javascript to set a property on 'mediaclient', I put the following in Page_Load: this.RegisterStartupScript("setGUID", "<script language=javascript>mediaclient.strFileGUID=\"6a35ba9b-bbde-4678-9057-fb15c7 a685b8\";var gControl = mediaclient;alert(gControl.strFileGuid);</script>"); With the object in the form section, this bombs out saying that mediaclient is null. So I tried putting it in the <body> section, before the <form> section, and this works nicely, I can set the property and then use it when I call functions of the UserControl. I then tried to put it after the <form> section, but still in the <body> section, as I'd like it to be on the bottom of the page. Unfortunately, it bombed out there too, saying that mediaclient was once again null. Does anyone have any advice on getting around this or a different strategy to suggest? Thanks Joe
  • 3. Problem with ControlDesigner and GetDesignTimeHtml
    Hello, I'm trying to do a control that does an html table around other controls, it works 100% fine, but I have decided to implement design time viewing, now I'm in trouble. It works, but it does not render any nested controls inside my control (which inherits from a Panel), so no child controls are rendered in design time at all. Of course, if I don't use a designer, I have the standard Panel behavior, but this is not what I want, I want to see my html table rendered and the content inside the panel rendered too. There are very few examples on the web, and I have yet to see anybody doing a GetDesignTimeHtml method that, for exemple, render a datagrid inside it... Can anybody help? This is not really needed, but design time viewing is pretty useful. Thanks.
  • 4. Child controls within Calendar control
    I am trying to extend the Calendar control to provide for custom binding through datasets etc. Everything is working just find till I try to add LinkButtons within the cells of the calendar. Here is a code snippet. private void MonthlyCalendar_DayRender( object sender, System.Web.UI.WebControls.DayRenderEventArgs e ) { ... LinkButton Lb = new LinkButton(); Lb.Text = "Some Link"; Lb.CommandName = "APPT_CLICKED"; Lb.CommandArgument = AppointmentInfoObject.PostbackData; Lb.Command += new CommandEventHandler( AppointmentClick_EventHandler ); Lb.Style.Add( "font-weight", "normal" ); Lb.Style.Add( "font", e.Cell.Font.Name ); Lb.Style.Add( "font-size", e.Cell.Font.Size.ToString() ); Lb.ToolTip = AppointmentInfoObject.AppointmentDetails; e.Cell.Controls.Add( Lb ); ... } While the LinkButton itself gets rendered, there is no clickable link. The content is rendered as plain text. When I look at the HTML, I notice that the href='' has not been specified. It is rendered as -- <a>Some Link</a>. Any help would be greatly appreciated. Thanks in advance. Sanjay

Can I use OnTextChanged in JavaScript for TextBox

Postby Leo » Thu, 20 Nov 2003 03:25:39 GMT

I have my textbox control, I want to fire an event for 
TextChanged, how can I do this?

Can I use OnTextChanged in JavaScript for TextBox

Postby Jon Paugh » Thu, 20 Nov 2003 05:32:52 GMT

try this:
set the "OnChange" attribute for your server side control 
to your js function in the onload event of your page's 


Similar Threads:

1.JavaScript for OnTextChanged event.


I have created a web-based file manager. Now I'd like to watch a folder for 
changes, and when a change occurs I'd like to refresh my page.
Okay. So I have created a FileSystemWatcher set on the folder I need to 
watch. It works fine. The problem occurs when I need to trigger an automatic 
So I added two handlers - OnChanged and OnRename, in the same class as my 

In the handlers I tried to say Response.redirect(mypage) to force the 
refresh, but the error I got was: "Cannot redirect after HTTP headers have 
been sent."

So I tried to change the text of some textbox instead
<asp:textbox id="txtFileSystemWatcher" 
OnTextChanged="javascript:RefreshPage();" Visible=true  Width=500 

with this handler:
Private Sub OnChanged(ByVal source As Object, ByVal e As 
    txtFileSystemWatcher.Text = "FileSystemWatcher: " & "File: " & 
e.FullPath & " " & e.ChangeType
End Sub

and add an OnTextChanged client-side event-handler which looks like this:

function RefreshPage() {
    __doPostBack('txtFileSystemWatcher', '');

which would force the refresh. However, now I have the following error:
BC30456: 'javascript' is not a member of 'ASP.BrowseFiles_aspx'.

So I changed the HTML to
<asp:textbox id="txtFileSystemWatcher" OnTextChanged="RefreshPage()" 
Visible=true  Width=500 Runat=server></asp:textbox>
and now, sure enough, I get
BC30456: 'RefreshPage' is not a member of 'ASP.BrowseFiles_aspx'.

I also tried in OnLoad of the page to register the event with
txtFileSystemWatcher.Attributes.Add("OnTextChanged", "RefreshPage()")

but it still does not work.

What am I missing here, please ?

Thank you, Alex 

2.Accessing Textbox inside a Template column using javascript

I am having a datagrid with a template column. Inside the template column I
have a textbox and an image button. On click of the image button, I want to
call a javascript function, where the textbox value has to be taken.

Since the textbox is inside the datagrid, how can I access the Textbox in a
javascript function?

what is happening now is that if I give document.frmname.textboxname then it
won't recognise because for textboxes in each row of the datagrid is
internally given a different name.

can you please assist me regarding this?

Thanks & Regards,

3.How can i change de cssclass of a textbox in runtime using javascript

I need to change de css of an textbox control.
So, on mouseover event, the class will be one, and on mouseout event it will 
be another.
Something like:


How can i do that?
Somebody have any idea?


Fernando Lopes 

4.get Textbox Value in datagrid using JavaScript

Hi, All:

I have a datagrid that embedded 3 textbox using TemplateColumn. When
the user key in value in the first textbox, I need to check to see if
this value is between the the values in other 2 textboxes. I know I can
postback to server side and using datagrid findcontrol to get values of
these 3 textboxes and compare them. But it kind of combersome cause
every change in textbox 1 I need send back to server.

My question is how can I get other 2 textboxes values in the same row
of textbox1 using Javascript? I am using onChange function for
textbox1. Is it doable? any example?

Thanks a lot
-Rockdale can I used javascript for chaging values in TextBox

6. link textboxes in gridview EditItem template using javascript

7. Dynamically generate textboxes using javascript

8. How to get OuterHtml in a TextBox using Javascript

Return to ASP.NET


Who is online

Users browsing this forum: No registered users and 81 guest