Jump to content
Sign in to follow this  
Bhushan

CheckBox in DataGrid

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.

Share this post


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.

Share this post


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.

Share this post


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;}}}}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...