CheckBox in a datagrid control

E

E-Cube

Hello All,

I have a datagrid that will retrieve data from my sql database, on the data
grid once the data has been loaded is a checkbox per datagrid row.
I would like to know what is the eventhandler should I be using to pick up a
checked event from a checkbox in a datagrid control?

Thank you in advance for any help.
E-Cube
 
M

Mohamed El Ashmawy

Hello,
The eventhandler would be using the OnCheckedChanged event.
You should put the checkbox as
<asp:CheckBox ID="rrr" Runat="server" OnCheckedChanged="test"
AutoPostBack="true"></asp:CheckBox>
in the itemtemplate of a template column

In the code behind you need to create a method test as follows:
Public Sub test(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write("Checked")
End Sub


This should work as normal.
P.S. Please check that you don't re-bing the grid at postbacks as this
would remove the event so the event handler won't work
Regards
Mohamed El Ashmawy
MEA Developer Support Center
ITWorx on behalf of Microsoft EMEA GTSC
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top