Hi Bill,
Are you providing everything that is required for the event to fire? You
might be missing Autopostback.
Here's some demo code that might get you going. Let us know if it helps?
Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
' Quick sample of creating objects
' and including events using AddHandler
' Ken Cox April 9, 2006
Dim lbl As New Label
lbl.ID = "lblText"
lbl.Text = "Nothing"
PlaceHolder1.Controls.Add(lbl)
Dim lit As New Literal
lit.ID = "lit1"
lit.Text = "<br />"
PlaceHolder1.Controls.Add(lit)
Dim btn As New Button
btn.Text = "Click me"
btn.ID = "btn1"
AddHandler btn.Click, AddressOf but_click
PlaceHolder1.Controls.Add(btn)
Dim tb As New TextBox
tb.ID = "Textbox1"
tb.AutoPostBack = True
AddHandler tb.TextChanged, AddressOf tbEventHandler
PlaceHolder1.Controls.Add(tb)
End Sub
Sub tbEventHandler(ByVal sender As Object, ByVal e As System.EventArgs)
Dim lbl As Label
lbl = Page.FindControl("lblText")
If Not IsNothing(lbl) Then
lbl.Text = "The textbox changed!"
End If
End Sub
Sub but_click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim lbl As Label
lbl = Page.FindControl("lblText")
If Not IsNothing(lbl) Then
lbl.Text = "The button was clicked!"
End If
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Addhandler</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp
laceholder id="PlaceHolder1" runat="server"></asp
laceholder>
</div>
</form>
</body>
</html>