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

Checked checkbox when row select in RadGrid (Use web user control) ?

4 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pham
Top achievements
Rank 1
Pham asked on 14 Sep 2011, 04:36 AM
I have a problem about checkbox and Web user control. I want tick checkbox when choose row in RadGrid. I use web page, I cant tick with this code:
var chbox = document.getElementById("checkbox1");
chbox.checked = true;

But when I use Web User Control, I have error. This code is not excute. Have you any idea? Thanks you very much!

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Sep 2011, 06:06 AM
Hello DucAnh,

I am not quite sure about your requirement. If you want to select the CheckBox while selecting the grid row, you can use GridClientSelectColumn(instead of using CheckBox control). For more information about GridClientSelectColumn, please have a look in to the following documetation .
Column Types

Thanks,
Princy.
0
Pham
Top achievements
Rank 1
answered on 14 Sep 2011, 07:26 AM
Hello Princy!
My requirement is select checkbox "CSPK"(in this image) when I choose row select - it isn't in radgrid:
function setValues(d_diem_do) {           
   $find("<%= dtpNGAY_HLUC.ClientID %>").set_selectedDate(d_diem_do.NGAY_HLUC);
   var chbox = document.getElementById("checkbox1");
   chbox.checked = true;
}
0
Andrey
Telerik team
answered on 16 Sep 2011, 10:10 AM
Hi Ducanh,

One approach to achieve your goal is to hook the OnRowSelected client event and in its body to call your function. Thus when row is selected the checkbox outside the grid would be checked too. But notice that this code will execute every time when  row is selected and it is not connected with particular row. This event is raised when any row from RadGrid is selected. This is an example illustrating the above mentioned approach:
<script type="text/javascript">
        function RowSelected(sender, eventArgs) {
            findCheckbox();
        }
        function findCheckbox() {
            var chbox = document.getElementById("CheckBox1");
            chbox.checked = true;
        }
    </script>


All the best,
Andrey
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
Pham
Top achievements
Rank 1
answered on 18 Sep 2011, 11:04 AM
Thanks Princy! Your idea is very accurate.
Tags
Grid
Asked by
Pham
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Pham
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or