473,396 Members | 1,916 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.

How to find Checkbox in its event handler?

Hi Guru?
The scenario is I am creating a number of checkboxs dynomically and
when I do that I am also creating event handler for them. So when a
checkbox is checked, in the event handler I can do something using its
ID but the problem is how to get its ID?

--------------- creating checkbox dynamically
-----------------------------

Private Function GetUpdateNotificationCheckBox(ByVal valPacketID As
String) As TableCell

Dim l_ReturnCell As New TableCell()

Dim l_CheckBox As New CheckBox()

l_CheckBox.ID = "chkUpdateNotification" & valPacketID

l_CheckBox.AutoPostBack = True

AddHandler l_CheckBox.CheckedChanged, AddressOf
Me.chkUpdateNotification_Checked
-------- event handler -------------------------------

Private sub chkUpdateNotification_checked (byval sender as
system.object,byval e as system.eventArgs)

' I want to get its ID here
end sub

Thanks in advance
Nov 17 '05 #1
4 2353
PJ
um, give it an .ID property when you create it. if it's in a databound
control, you may have to use it's .UniqueID property.

~PJ

"Leon" <yo******@yahoo.com> wrote in message
news:8a**************************@posting.google.c om...
Hi Guru?
The scenario is I am creating a number of checkboxs dynomically and
when I do that I am also creating event handler for them. So when a
checkbox is checked, in the event handler I can do something using its
ID but the problem is how to get its ID?

--------------- creating checkbox dynamically
-----------------------------

Private Function GetUpdateNotificationCheckBox(ByVal valPacketID As
String) As TableCell

Dim l_ReturnCell As New TableCell()

Dim l_CheckBox As New CheckBox()

l_CheckBox.ID = "chkUpdateNotification" & valPacketID

l_CheckBox.AutoPostBack = True

AddHandler l_CheckBox.CheckedChanged, AddressOf
Me.chkUpdateNotification_Checked
-------- event handler -------------------------------

Private sub chkUpdateNotification_checked (byval sender as
system.object,byval e as system.eventArgs)

' I want to get its ID here
end sub

Thanks in advance

Nov 17 '05 #2
This checkboxs don't appear in datagrid.
I did give them their unique ids however, my question remians how to get
this id in event handler
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3
use :
((System.Web.UI.WebControls.WebControl)sender).ID
or cast to your control:
((System.Web.UI.WebControls.DropDownList)sender).I D

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4


Thank you Natty Gur so much
All the best

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #5

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

Similar topics

13
by: aundro | last post by:
Hello, I've been looking on the web for a solution to this problem: I create a set of checkboxes, and 2 buttons: - one is labeled "All" - the other is labeled "None" Clicking "All" is...
3
by: rodrigo guerra | last post by:
i have a checkbox and a dropdownlist in 2 templatecolumns in a datagrid. how can i add a onClick/CheckedChanged event handler to a checkbox in the datagrid ? i want to enable a dropdownlist...
2
by: Tomas Vera | last post by:
Hello All, I'm having problems creating a page with dynamic checkboxes in a WebApp. In my app, I need to query a database, then (based on results) add checkboxes to my form and set their...
5
by: Dan | last post by:
Hi, I'd like to find out the control that caused a postback to be raised. Obviously this could simply done in a control event handler. I am not going to do this method and would like no...
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
7
by: Lars Netzel | last post by:
If I put a checkbox in a datagrid (ASP.NET) and set the Autopostback to true I can catch OnChange event on checkbox but how do I then catch what DataGridItemIndex is? Can I use some Event in the...
8
by: Grorange | last post by:
Writing ASP.NET pages, I have a need for client-side functions to prevent going to the server for every small change. I have a list of server side created checkboxes filled with a lot of...
3
by: | last post by:
Hi all, I have a CheckBoxList control which has about 10 items. I have set autopostback=true and also set an eventhandler for OnSelectedIndexChanged. The problem is I want to identify which...
4
by: sarabonn | last post by:
Hello everyone, Iam firing a event in the chechbox_checkedchanged. It works fine private void checkBox1_CheckedChanged(object sender, EventArgs e) { ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.