Handling events for Checkbox in Data Grid

  • Thread starter Abhijit Salvi via .NET 247
  • Start date
A

Abhijit Salvi via .NET 247

(Type your message here)

--------------------------------
From: Abhijit Salvi

Hi All,

I am working on a DataGrid that has a column of Checkbox Controls. There is some Business Functionality that I need to accomplish when the Checkboxes in the column are checked or unchecked, basically on the 'onCheckChanged' Event of the checkbox.

However I am not able to get handle to this event of the Checkbox.

I have found numerous examples on the net for Checkbox in Repeaters but I guess the same does not work with checkbox in Data Grids. The 'onCheckChanged' event needs to be "raised".

I get the following errors
'Public Event CheckedChanged(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

'System.EventHandler' is a delegate type. Delegate construction permits only a single AddressOf expression as an argument list. Often an AddressOf expression can be used instead of a delegate construction.

Have you or any body you know tried using Checkboxes in datagrid. I would greatly appreciate any help wrt this.

Thanks in advance,

Regards,
Abhijit
 
E

Elton Wang

Hi Abhijit,

In order to fire and handle the event of some server
control inside a datagrid, you can do following steps:

1. In its HTML code, set AutoPostBack=true and there is an
event trigger, e.g. OnCheckedChanged
="Event_handler_method_name".

2. There a Event_handler_method with two Args, Object and
EventArgs. In your case, it could be:

Public[/Protected] Sub CheckedChanged(sender As Object, e
As System.EventArgs)
' Code here
End Sub

3. Then coding in the method.

That's it!

HTH

Elton Wang
(e-mail address removed)

-----Original Message-----
(Type your message here)

--------------------------------
From: Abhijit Salvi

Hi All,

I am working on a DataGrid that has a column of
Checkbox Controls. There is some Business Functionality
that I need to accomplish when the Checkboxes in the
column are checked or unchecked, basically on
the 'onCheckChanged' Event of the checkbox.
However I am not able to get handle to this event of the Checkbox.

I have found numerous examples on the net for
Checkbox in Repeaters but I guess the same does not work
with checkbox in Data Grids. The 'onCheckChanged' event
needs to be "raised".
I get the following errors
'Public Event CheckedChanged(sender As Object, e As
System.EventArgs)' is an event, and cannot be called
directly. Use a 'RaiseEvent' statement to raise an event.
'System.EventHandler' is a delegate type. Delegate
construction permits only a single AddressOf expression as
an argument list. Often an AddressOf expression can be
used instead of a delegate construction.
Have you or any body you know tried using Checkboxes
in datagrid. I would greatly appreciate any help wrt this.
 

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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top