Event for a class
-
Hi. I have a WebUserControl. It has a Text property ( I've written it ) I need an event in this class (my userControl) that fires by changing the Text Property. I wrote an Event like this in my usercontrol event: Public Event Text_Changed(ByVal sender As Object, ByVal e As EventArgs) and in another class I've written this: AddHandler Text_Changed, AddressOf MyMethod Public Sub MyMethod(ByVal sender As Object, ByVal e As EventArgs) End Sub But I don't know how automatically runs the MyMethod by changing the Text Property of userControl
Best wishes
-
Hi. I have a WebUserControl. It has a Text property ( I've written it ) I need an event in this class (my userControl) that fires by changing the Text Property. I wrote an Event like this in my usercontrol event: Public Event Text_Changed(ByVal sender As Object, ByVal e As EventArgs) and in another class I've written this: AddHandler Text_Changed, AddressOf MyMethod Public Sub MyMethod(ByVal sender As Object, ByVal e As EventArgs) End Sub But I don't know how automatically runs the MyMethod by changing the Text Property of userControl
Best wishes
Text_Changed(Me, EventArgs.Empty)
-
Hi. I have a WebUserControl. It has a Text property ( I've written it ) I need an event in this class (my userControl) that fires by changing the Text Property. I wrote an Event like this in my usercontrol event: Public Event Text_Changed(ByVal sender As Object, ByVal e As EventArgs) and in another class I've written this: AddHandler Text_Changed, AddressOf MyMethod Public Sub MyMethod(ByVal sender As Object, ByVal e As EventArgs) End Sub But I don't know how automatically runs the MyMethod by changing the Text Property of userControl
Best wishes
I think the problem with you is the postback thing. Let me remind you, you need to do a postback to generate the serverside event. I think you can make a handler to generate the event. If you want to avoid postback, you can call a custom handler using Javascript and AJAX. Use it to generate server side event. :rose:
Abhishek Sur