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


K

Kathy Burke

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
 
Ad

Advertisements

S

Severin

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top