This is a migrated thread and some comments may be shown as answers.

[Solved] Directly edit the GridCheckBoxColumn

2 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erwin
Top achievements
Rank 1
Erwin asked on 02 Jun 2009, 10:44 AM
I have a grid that has a GridCheckBoxColumn..

I want to edit the GridCheckBoxColumn's checkbox but i dont want to make use of its ridTextBoxColumnEditor

I want to make it simple...

if the user will double click any part of the row the GridCheckBoxColumn checkbox will

be checked. It should not rebind the grid. Only one checkbox should be checked.

I have trouble using the ItemTemplate thats why im using  GridCheckBoxColumn.
 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Jun 2009, 11:43 AM
Hello Erwin,

You can try out teh following code to check mark the checkbox in the CheckBoxColumn of a row when a row is double clicked:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
       if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            CheckBox checkbx = (CheckBox)dataItem["CheckBoxColumnUniqueName"].Controls[0]; 
            dataItem.Attributes.Add("ondblclick""SelectCheckBox('"+ dataItem.ItemIndex + "','" + checkbx.ClientID + "');");   
             
        } 
    } 
        

js:
function SelectCheckBox(rowindex,checkboxID) 
    var grid = $find("<%=RadGrid1.ClientID %>"); 
    var MasterTable = grid.get_masterTableView(); 
    var Row = MasterTable.get_dataItems()[rowindex]; 
     
    var checkboxes = Row._element.getElementsByTagName("INPUT");  
    var index;                         
    for(index = 0; index < checkboxes.length; index++)    
     {                          
       if(checkboxes[index].id.indexOf(checkboxID)!=-1)    
           {                            
               checkboxes[index].checked = true;    
               checkboxes[index].disabled = false;       
           }    
     }       

Thanks
Princy.
0
Erwin
Top achievements
Rank 1
answered on 02 Jun 2009, 04:53 PM
I'm not using Input box, im using the GridCheckBoxColumn which has a default checkbox on it and
i'm using javascript and vb...

I'm using the client event of the grid which is ondoubleclick.

is their any much simpler way?

I only need to check the check box in the GridCheckBoxColumn


Tags
Grid
Asked by
Erwin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Erwin
Top achievements
Rank 1
Share this question
or