473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Handling the events

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.
Nov 21 '05 #1
1 1014
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

"krishna" <kr***********@nanncomputers.com> wrote in message
news:04****************************@phx.gbl...
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.

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marinos Christoforou | last post by:
Sorry if this has been asked before but as an inexperienced wanna-be C# programmer I wondering how to code classes to help build a standard Windows UI. For example to build a common toolbar. I...
2
by: Eric Newton | last post by:
VB's more declarative nature of handling events is golden. I'm hoping C# will acquire this type of deal, in addition to the anonymous delegates. could do same as vb (actually would be easier to...
4
by: hillcountry74 | last post by:
Hi, I'm a newbie and trying to understand event handling in c#. I have understood handling events using delelgate objects. But not this method- "Event handling by overriding the virtual...
3
by: Ashok Kumar K | last post by:
Hi all, Where can I get some insight on using the __hook, __unhook, event_source and event_receiver for specifically COM events. The documentation given in MSDN is very minimal. I have the...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
9
by: Sridhar | last post by:
Hi, I have created a web page which includes a place holder. I also have a dropdown list in that webpage. when I select one of the choices in that dropdown list, It will load a user control...
2
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the...
11
by: chopsnsauce | last post by:
Here's the example: Dim frm As New FORM1 Try frm.show Catch ex As Exception msgbox ex.message
2
by: Jordan | last post by:
I need to handle UI events in a worker thread instead of the primary UI thread. In C#, is the normal UI event handling behavior to run in a context thread on the thread pool or are events always...
35
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.