473,789 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript for OnTextChanged event.

Hi.

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 FileSystemWatch er set on the folder I need to
watch. It works fine. The problem occurs when I need to trigger an automatic
Refresh.
So I added two handlers - OnChanged and OnRename, in the same class as my
filemanager.

In the handlers I tried to say Response.redire ct(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="txtFileSyst emWatcher"
OnTextChanged=" javascript:Refr eshPage();" Visible=true Width=500
Runat=server></asp:textbox>

with this handler:
Private Sub OnChanged(ByVal source As Object, ByVal e As
FileSystemEvent Args)
txtFileSystemWa tcher.Text = "FileSystemWatc her: " & "File: " &
e.FullPath & " " & e.ChangeType
End Sub

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

function RefreshPage() {
__doPostBack('t xtFileSystemWat cher', '');
}

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

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

I also tried in OnLoad of the page to register the event with
txtFileSystemWa tcher.Attribute s.Add("OnTextCh anged",
"javascript:Ref reshPage()")
and
txtFileSystemWa tcher.Attribute s.Add("OnTextCh anged", "RefreshPage()" )

but it still does not work.

What am I missing here, please ?

Thank you, Alex
Nov 19 '05 #1
1 16543
1. Don't write stuff like '__doPostBack' yourself, ever. Use
Page.GetPostBac kEventReference instead if you want to get the postback
function call.
2. Why not set your textbox's AutoPostBack to true? In that case the
textbox control will render an onchange client-side eventhandler, which
will postback if the text was changed.

----
- Wilco Bauwer
Blog & Custom Controls @ http://wilcoding.xs4all.nl

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1309
by: Ashok Gopalan | last post by:
How do I attach a client-side validation script in a web form page for a text box control. The intellisense dropdown does not show the common "OnChange" event. Any help is greatly appreciated. Regards, AG
3
3549
by: Neil | last post by:
Hi, I have a datagrid containing a number of item templates, inside of these item templates I have various controls like the textbox. The user is able to edit all the fields on the datagrid at once and then click an update button. I'm trying to use the OnTextChanged event to capture which rows where updated before I update the DB. I have added the line OnTextChanged="RowChanged" to my text box control in the HTML and added the event...
1
2756
by: mdipiet | last post by:
I've got a form that is supposed to validate data entry from a bar code scanner. The scanner is set up to add a carriage return at the end of the data in the barcode, which should fire the onTextChanged event to validate the information recieved; however, the Enter key does not fire this event as it should. Can anyone give me some help as to why the Enter key won't fire the onTextChanged event? Matt
4
7401
by: MattB | last post by:
Hi. I'm working on an intranet application that requires a user to input information about themselves. I have a user control with a couple of textboxes that I want the user to enter their weight into. One is for Lbs and one is for kg and I'm using the OnTextChanged event to populate the other control if one is filled in (converting between kg and Lbs). It works, but when one TextBox is changed and it sets the other's value, the second...
0
1447
by: RajS | last post by:
Hi All, I am trying to update datagrid, onTextchanged event, I dont know how to do this. please shed some light or any examples. Here is the code I am wrestling with. OnTextChanged event of Textbox1 I want to pass price and ID to this event, how can I pass? //DataGrid html code <asp:TextBox id="Textbox1" Text='<%#
1
4908
by: Fred Dag | last post by:
As far as I can work out when using the OnTextChanged event I cannot get the TextBox and Labels values when the event fires as they are populated by a <asp:repeater and so don't have values. If I try to give the repeater values by removing if (!IsPostBack) {} from the
2
2489
by: rockdale | last post by:
Hi, All I have a textbox for user to input SSN, I havea javascript to format what he input to SSN format, I also have a onChange postback function to retrieve other info based on the SSN. <asp:TextBox id="txtSSN" runat="server" AutoPostBack="true" onKeyDown="javascript:myJavaFunction"></asp:TextBox>
3
12253
by: John Kotuby | last post by:
Hi all... I am trying to do a simple thing and maybe am missing something elementary. I have created a Javascript function at the top of a page which is meant to enable editing of an HTML input textbox when the user makes a selection from the DropDownList control. Since there is no OnClick event I have tried using OnSelectedIndexChanged or OnTextChanged such as OnTextChanged ="ckCat()" with ckCat being the javascript function name. I...
4
5360
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a text field which causes the Autocomplete extender to display 10 like items, after the users selects an item (which is a key in the database) I want the application to go to the database retrieve a record and populate the fields.
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.