Name: sthchris Date: August 24, 2004 at 22:33:30 Pacific Subject: checkbox within datagrid (ASP.NET) OS: Win2Kserver CPU/Ram: P4 2G/512MB
Comment:
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?
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.
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?
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE