Handling the events

K

krishna

Hi,
Hi,


I would like to handle the events for the dynamically
created controls at runtime.


I Have written the code in HTML View of an asp.net
page.like this

<script runat="server">
public sub hai(sender as object,e as eventargs)
Dim tr As New TableRow
Dim td1 As New TableCell
Dim Che As New CheckBox
Che.ID = "chkDynamicCheckBox"
Che.Text = "This is a dynamically generated
checkbox"
td1.Controls.Add(Che)
Dim td2 As New TableCell
Dim drop1 As New Button

drop1.Width = New Unit(50)
addhandler button.click,addressof hello
td1.Controls.Add(drop1)
tr.Cells.Add(td1)
tr.Cells.Add(td2)
Table3.Rows.Add(tr)

end sub

public sub hello(ByVal sender As Object, ByVal e As
System.EventArgs)
response.redirect("hello")
end sub

It is giving an error at this point

" addhandler button.click,addressof hello"


My aim is i have created a button drop1 at runtime when i
click this button it should give messge that "Hello"


Any one plz help me.


Regards,
Krishna.
 
J

JohnFol

I *think* this is because you need to reference drop1 and not a button that
does not exist.
Could you post a bit more code as this does not compile due to Table 3(
amongst other things) being missed out
 

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

Top