Last post Jul 12, 2005 01:17 PM by pschaef
Jun 14, 2005 06:05 AM|rsmantrala|LINK
I declared an event in a webpart page for a button click. When i place the web part in a web page(aspx), the event is not triggering and it is working when i place it in a sub area of sharepoint. Any ideas how to make the event work?
Jul 12, 2005 01:17 PM|pschaef|LINK
What do you mean by "I declared an event in a webpart page"?
Are you trying to handle a click that occurs inside a WebPart? If so, then the handler must be declared inside the WebPart assembly. For example, the following would be in the CreateChildControls routine:
Dim saveBtn as Button = New Button
saveBtn.ID = "save"
saveBtn.Text = "Save"
AddHandler saveBtn.Click, AddressOf SaveButton_OnClick
And the handler needs to be defined with the usual signature:
Public Sub SaveButton_OnClick(ByVal sender As Object, ByVal e As EventArgs)