Jump to content

CheckBox in DataGrid


Bhushan

Recommended Posts

Hi ,I have 2 columns in my datagrid. first one fetches column names and second one contains checkbox.I want to assign the text in first column to a variable depending on the checkbox ( when it is checked).Since checkbox doesn't contain commandName property, I cannot handle in OnItemCommand function.How can I achieve it??.Thanks,Bhushan.

Link to post
Share on other sites

In visual studio if you double click the checkbox (design mode) it will create a function for the on click/change you would do a check to see if the checkbox is checked there then assign the variabl;e value to the first column of the datagrid.

Link to post
Share on other sites

Hi,I cannot double click on the checkbox since it is the child control. it's placed on the datagrid. How can I make use of e ??Is there any other way to achieve this??.Thanks,Bhushan.

Link to post
Share on other sites

Hi,I am making use of below code to check and uncheck my check boxes in the datagrid. But I am facing a problem here. When I click on the checkbox in the datagrid header, it checks all the datagrid box ( as expected) but the corresponding value fetched by it is repeating.Ex: I was expecting Pname,Pcode,Ptime,Pyear but it's fetching Pname,Pcode,Ptime,Pyear,Pname,Pcode.Anything wrong with the below code??........function SelectAll(CheckBoxControl) {if (CheckBoxControl.checked == true) {var i;for (i=0; i < document.forms[0].elements.length; i++) {if ((document.forms[0].elements.type == 'checkbox') && (document.forms[0].elements.name.indexOf('reportGrid') > -1)) {document.forms[0].elements.checked = true;}}} else {var i;for (i=0; i < document.forms[0].elements.length; i++) {if ((document.forms[0].elements.type == 'checkbox') && (document.forms[0].elements.name.indexOf('reportGrid') > -1)) {document.forms[0].elements.checked = false;}}}}

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...