C'è un modo veloce per poter assegnare a tutte le textbox di una pagina lo stesso evento di textchanged??![]()
C'è un modo veloce per poter assegnare a tutte le textbox di una pagina lo stesso evento di textchanged??![]()
codice:Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init Dim ls As List(Of TextBox) = l.GetChildControls(Of TextBox)(Me.Form) For Each c As TextBox In ls c.AutoPostBack = True AddHandler c.TextChanged, AddressOf TextBox_TextChanged Next End Sub Protected Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim t As TextBox = DirectCast(sender, TextBox) Me.Label1.Text = t.ID & " = " & t.Text End Sub
Pietro