Help with CheckBox inside a TemplateColumn

J

JasmineC

In my datagrid, I created a CheckBox in a TemplateColumn. And I need to be
able to update my table every time the user checks the CheckBox, but I can't
seemed to find a way to trigger the checkbox event. I also can't get the
current row index for my datagrid. Does anyone have any idea????

Thanks in advance!!!

JasmineC
 
E

Eliyahu Goldin

Did you set AutoPostBack="True" for the checkbox? And datagrid.SelectedItem
doesn't work? Once you get the event working, you will get the reference to
the checkbox that generated the event as a parameter. You can reach the row
index from there.

Eliyahu
 
E

Eliyahu Goldin

You don't have to setup server event for the checkbox. With autopostback
property set to true, there will be two hidden variable in your form
__EVENTTARGET and __EVENTARGUMENT which you can access in Page_Load event to
get the control name which caused the postback. __EVENTTARGET will have the
object which fired the post back event. Once you know the sender, you can
use Parent.Parent to get to the datagrid row (the checkbox is in a
TableCell, so the first Parent gets to the cell, and then second Parent gets
from the cell to the row).


Eliyahu
 

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
474,143
Messages
2,570,821
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top