473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Textbox onchange won't fire after fill-in from popup window?

Hi, I have a textbox and a calendar popup window. I got this from a
posting (sorry, his name escapes me at the moment). It's nice and
simple, so I like it, of course.

Only problem I have is that when the popup closes and puts the control
value (date selected) into the textbox on my main form, I can't get my
onchnage event to fire (i.e., which should load a datagrid).

This is the sub that the calendar pop-up form uses when the date is
selected.

Protected Sub Change_Date(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim strScript As String = "<script>window.opener.document.forms(0)." +
control.Value + ".value = '"
strScript += calDate.SelectedDate.ToString("MM/dd/yyyy")
strScript += "';self.close()"
strScript += "</" + "script>"
RegisterClientScriptBlock("anything", strScript)
End Sub

I'm sure I'm missing something simple.

Thanks for any insights.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
1 6581
The OnChange event will not fire if the change is made from code...

What you could do, is call the OnChange event yourself, after setting the
new text in the textbox, passing (Nothing, Nothing) to the Sub
TextBox_OnTextChanged(ByVal sender as Object, e as EventArgs)
Once returning to the main form (after pop-up closes itself) call teh
onchange event cause you know the text has changed, you just chagned it!
TextBox_OnTextChange(Nothing, Nothing)


"Kathy Burke" <ka**********@attbi.com> wrote in message
news:ex**************@TK2MSFTNGP11.phx.gbl...
Hi, I have a textbox and a calendar popup window. I got this from a
posting (sorry, his name escapes me at the moment). It's nice and
simple, so I like it, of course.

Only problem I have is that when the popup closes and puts the control
value (date selected) into the textbox on my main form, I can't get my
onchnage event to fire (i.e., which should load a datagrid).

This is the sub that the calendar pop-up form uses when the date is
selected.

Protected Sub Change_Date(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim strScript As String = "<script>window.opener.document.forms(0)." +
control.Value + ".value = '"
strScript += calDate.SelectedDate.ToString("MM/dd/yyyy")
strScript += "';self.close()"
strScript += "</" + "script>"
RegisterClientScriptBlock("anything", strScript)
End Sub

I'm sure I'm missing something simple.

Thanks for any insights.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2

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

Similar topics

1
by: James Howe | last post by:
I have a page which has a small number of input fields and some areas on the screen where the user can click to make things happen. These areas are generally <span>s with some associated onclick...
11
by: Bob Bedford | last post by:
I'd like to fire a JS function from the Onchange event of a Text edit. Unfortunately it doesn't fire when I hit any key, but only when leaving the control. I've tried with OnKeyup, and it works,...
7
by: Hans | last post by:
Hi! Does anybody of you have a good algorithm to capture when a value in a textbox is changed? I'm using the keypress/keydown events but they seems to be a bit inconsistent (IE and Mozilla)....
4
by: ms | last post by:
I have come across a problem where if a user enters the same text into a text input after the value has been programmatically changed, the onChange event does not fire for the second change. The...
10
by: Rob Nicholson | last post by:
In our application, we've added a bit of JavaScript that updates a title as the user types into a textbox. To trigger this, we patch into the "onkeyup" and "onpaste" events: ...
1
by: Steve | last post by:
hi all any body has any idea on how to fire onchange event of a pulldown menu with script. i need to trigger it so it when i select a certain option from script,the event handler is executed
1
by: almurph | last post by:
Hi everyone, Is it possible to make a new events for a Web-form textbox. What I mean to ask is that I want an event to fire everytime a user enters a letter into a Web-form textbox. The only...
2
by: William Cole | last post by:
Here is my issue I have two text fields (Field A, Field B). I want Field B to be updated when Field A is changed. The problem is Field A is being changed through JavaScript so an onChange event...
2
by: Joe Kovac | last post by:
Hi! Using: <asp:TextBox ID="TextBox1" runat="server" onchange="onchange()"></asp:TextBox> I get: Warning 1 Validation (ASP.Net): Attribute 'onchange' is not a valid
2
by: daitasri | last post by:
Hi I m creating a textbox dynamically on click of a button. I want to attach an onChange event for that textbox.I tried using following code but it does not seem to work.Can anyone suggest a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.