How can I use events within the server control

T

ton

Hi,
I wrote a customserver control with 2 columns showing the data from 1
record.
i use label & hyperlink as for the field name and text and checkboxes for
the other data.

I want to use the hyperlink. How can I get a postback on that hyperlink.

Ton
 
T

ton

Thanks for you reply

I've used the code you've send me. It did not work. I made my control a lot
simpeler and the result was the same.
It looked as if the button click event were not handled by te procedure of
the addresoff statement:

The code looks now like: (And I'm sure that the createchildcontrols is
called instaed of the the buttonclick procedure)

Protected Overrides Sub CreateChildControls()
If Me.Page.IsPostBack Then ' this is what runs after the button click
''Exit Sub '' (if I use Exit sub, no control is displayed)

End If

But = New Button

But.Text = "Submit"

But.ID = ClientID & "X"

Controls.Add(But)

AddHandler But.Click, AddressOf Me.ButtonClick

ChildControlsCreated = True

end Sub

Private Sub ButtonClick(ByVal sender As Object, ByVal e As System.EventArgs)

But = FindControl(ClientID & "X")

But.Text = "xxxx"

Controls.Add(But)

End Sub

I've dimensioned the button But as a private control, did not help
íve done this with the withevents keyword, no difference
and i've dimensioned them in the procedures createchildrecords and
buttonclick

no differences

Ton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top