Can I use OnTextChanged in JavaScript for TextBox


    Sponsored Links


  • 1. Client side script causing formatting problems
    We have a treeview whose leaves represent reports. When a user selects a leaf we validate and store serveral "Session" parameters and execute a client side script to open a new browser to render the report thus; Response.Write("<script>\"../WebReports/RepViewer.aspx\",\"_blank\",\"menubar=no,status=yes,resizable=yes\")</script>"); The original page has a fixed width and is setup to centre itself in the browser using the CSS "margin: 0 auto;". When the script executes the original page looses its margin setting and becomes left aligned, all other formatting is untouched. Does anyone have any ideas what's causing this and what the solution is ? Thanks in advance.
  • 2. Web Service, XSL Extension Object and WebControl
    Hi all, This is going to be a bit difficult to explain, but I'll try and make it easy... I currently have a Web Control Library, in which I have a Web Control that I over ride the Create Children to provide a rather complicated form. (inherits WebControl, INamingContainer). It all works fine when the control is dropped onto a page. Which is good. However, I have now been asked to make this a WebService! The reason behind this is that they want it completely independent from any project that may with to use the control. So that if the control needs to be updated, all other projects do not need to be updated either. How on earth can I go about doing this? I was looking at XSL "Extension Objects", and they 'look' like something that could do what I need. However, I have no true idea if this is what I need to be looking at or not! Help please. All progress will be shared with the rest of the community.
  • 3. Programmatically listening for an event?
    Hi, I have the following in an ASPX page, that is an event listener, that works fine. BasicSearch1.SearchActivated += new myWebControlLibrary.BasicSearch.SearchEventHandler(SearchResults1.PerformSearch); However, I would like to change the ASPX page to not assume the name of the control, but instead listen to the event programmatically. I tried the below, which does compile and resolve correctly, however, it does not appear to be 'listening' to the event and does not get triggered! foreach (Control ctrl in Page.Controls) { if (ctrl.GetType() == typeof(myWebControlLibrary.BasicSearch)) { // This SHOULD have worked! But it doesnt appear to indicate that it is listening! ((myWebControlLibrary.BasicSearch)ctrl).SearchActivated += new WebControlLibrary.BasicSearch.SearchEventHandler(SearchResults1.PerformSearch); } }
  • 4. Advice Needed: Three Web controls talk to each other?
    Hi all, I have a requirement to implement a Search Interface component. I would like to implement this using three different components, for maximum flexibility. The first two are "Basic" search and "Advanced Search". Both will use the same back-end logic to put the search together. I'm using a WebControl for both of these and overriding the CreateChildControls to composite controls together (textbox, button, etc.). The third component would be the "Search Results" component. I want to base this control on a DataGrid. The advice I need is how to get the search query from either of the first two components to the Search Results component? I would like for the Search Results to 'listen' for an event from one of the other two components. How do I go about this? I don't want to have to put code into the ASPX page to handle the communication between the two controls. Any advice, and direction of examples (in C#) would be fantastic and much appreciated. George

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