Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
It is an ASP.NET (vb) question regarding the checkboxes within a datagrid.
What I wanna to do is - when I check/uncheck a checkbox within the datagrid, it will call another function/procedure to do another thing. Can anybody please assist me in giving the appropriate coding to me?
Thanks in advance!

Just make sure that the postback property (or maybe it's autopostback) is set to true for the checkbox (in the item template of the datagrid). Then point the onClick attribute of the checkbox to the function of your choice.
-SN

I would like to modify the checkbox control's NAME attribute, in order to make it javascript-friendly? Any ideas would be greatly helpful. Right now, .net spits out a NAME attribute for the checkbox as "dgMyGrid:_ctl0:_chkMyCheckbox". Javascript will throw an error when you attempt to reference that checkbox (any of them) with that name. I would need to remove the colons (:) in order for javascript to accept the explicit reference. Microsoft has done this with their linkbuttons for example. They use dollar signs ($) and have the __doPostback javascript function split on the dollar signs and re-concatenate with colons before posting back to the server (triggered by clicking the linkbutton). Attempting to modify an attribute of a checkbox in a datagrid on the ItemDataBound event, results in a wrapping of a SPAN tag with the desired attribute and value inline with the tag. The checkbox's NAME attribute remains unchanged and the entire checkbox HTML markup is placed inside of this newly generated SPAN tag.
Any idea how to set/reference the checkbox NAME attribute in the datagrid on the ItemDataBound event?
Thanks in advance.
Craig

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |