S
shapper
Hello,
I am creating a custom control where I have a button.
Somehow my button click event is not being raised.
I tried to place different codes inside MyButton_Click and nothing
runs.
Then I added Context.Response.Redirect("http://www.google.com").
When I click the button postback is done but the page google is not
called.
I am on this for days. I looked everywhere in Google and everything
seems ok.
Could someone, please, tell me what to do to try to figure what is the
problem?
I don't know what else to try.
Thank You,
Miguel
Here is my code:
...
Public Class Contact
Inherits WebControl
Dim MyButton As New WebControls.Button
Private Sub MyButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Context.Response.Redirect("http://www.google.com")
End Sub
Private Sub MyButton_Init(ByVal sender As Object, ByVal e As
System.EventArgs)
MyButton.ID = Me.ID & "_bSubmit"
MyButton.Text = "Submit"
End Sub
Protected Overrides Sub CreateChildControls()
AddHandler MyButton.Init, AddressOf MyButton_Init
AddHandler MyButton.Click, AddressOf MyButton_Click
MyBase.Controls.Add(MyButton)
MyBase.CreateChildControls()
Me.ChildControlsCreated = True
End Sub
End Class
I am creating a custom control where I have a button.
Somehow my button click event is not being raised.
I tried to place different codes inside MyButton_Click and nothing
runs.
Then I added Context.Response.Redirect("http://www.google.com").
When I click the button postback is done but the page google is not
called.
I am on this for days. I looked everywhere in Google and everything
seems ok.
Could someone, please, tell me what to do to try to figure what is the
problem?
I don't know what else to try.
Thank You,
Miguel
Here is my code:
...
Public Class Contact
Inherits WebControl
Dim MyButton As New WebControls.Button
Private Sub MyButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Context.Response.Redirect("http://www.google.com")
End Sub
Private Sub MyButton_Init(ByVal sender As Object, ByVal e As
System.EventArgs)
MyButton.ID = Me.ID & "_bSubmit"
MyButton.Text = "Submit"
End Sub
Protected Overrides Sub CreateChildControls()
AddHandler MyButton.Init, AddressOf MyButton_Init
AddHandler MyButton.Click, AddressOf MyButton_Click
MyBase.Controls.Add(MyButton)
MyBase.CreateChildControls()
Me.ChildControlsCreated = True
End Sub
End Class