You have a couple of options here. When you add your checkbox to the
datagrid as a control, you may need to manually wire it to an event handler.
checkbox1.click += some handler. This gets called when the checkbox is
clicked. However, this depends on how you have added the control to the grid
and the type of datagrid (autogenerated or not) it is as the method used to
retrieve the check selection will vary depending on this implementation.
At most, data retrieval will either be thru code behind in which case you
just subscribe to the event as I've pointed out or it will be available thru
scripting client-side, in which case it is still available to the code
behind thru the request.form object
Consider one possible implementation (radiobutton example):
The control has been added dynamically to a template column containing label
controls.
Label lbl = (Label)e.Item.F indControl("myc olumn");
if(lbl != null)
lbl.Text = "<input type=radio name='samegroup ' value=myselecti on>";
The selected value is retrieved thru
string selected = Request.Form["samegroup"];
the expected value in the string selected is "myselectio n"
Modify the code as you see fit.
--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/2bz4t
"Mortel" <mo****@poczta. onet.pl> wrote in message
news:bt******** **@atlantis.new s.tpi.pl...
Hi,
I have a DataGrid on my page. I show CheckBox in every row to select my
rows and show one CheckBox in Title of that column to select all. I can use
function and parameter id to read data and set my CheckBox for DataSet,
for any Arrays, nevermind. But I have problem with get data from CheckBox when
user checked/unchecked it. How I can add my event to CheckBoxes or How I
can call any method when user change value.
Thanks for all.
Boniek