avevo capito proprio male!
L'UC deve solo lanciare un evento a cui si sottoscriverà il client.
esempio in basic
nell'UC ho un dropdown che lancia un evento quando si cambia la selezione.codice:Public Event SelectedIndexChanged As System.EventHandler Public Property DropDownList() As DropDownList Get Return Me.DropDownList1 End Get Set(ByVal value As DropDownList) Me.DropDownList1 = value End Set End Property Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged RaiseEvent SelectedIndexChanged(sender, e) End Sub
La pagina che contiene l'UC sottoscriverà l'evento (per esempio)
in questo esempietto, Label1 è nella stessa pagina, non nel master.codice:Protected Sub mio_user_control1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mio_user_control1.SelectedIndexChanged Dim ddl As DropDownList = DirectCast(sender, DropDownList) Me.Label1.Text = ddl.SelectedItem.Text End Sub
Se è nel master puoi vedere il codice di prima.
1) nel master metto una property public readonly che mappi Label1
2) segui il codice di prima...

avevo capito proprio male!
Rispondi quotando