Hi, Telerik,
I have a RadGrid with a checkbox in each row. I need to use JavaScript to iterate each row and check and see whether each row are checked. The checkbox is defined in <telerik:GridTemplateColumn> in MasterTableView. How do I do that?
I have a RadGrid with a checkbox in each row. I need to use JavaScript to iterate each row and check and see whether each row are checked. The checkbox is defined in <telerik:GridTemplateColumn> in MasterTableView. How do I do that?
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 28 Mar 2013, 04:15 AM
Hi,
Try the following javascript.
JS:
Thanks,
Shinu
Try the following javascript.
JS:
function
onclick() {
var
masterTable = $find(
"<%= RadGrid1.ClientID %>"
).get_masterTableView();
var
row = masterTable.get_dataItems();
for
(
var
i = 0; i < row.length; i++)
{
var
chk=masterTable.get_dataItems()[i].findElement(
"CheckBox1"
);
}
}
Thanks,
Shinu
0
jnh999
Top achievements
Rank 1
answered on 28 Mar 2013, 05:02 PM
Thank you. It worked.
Another follow up question. I need to get other values in the same row. How do I get that. the rendered html is as follows:
<td>
<span title="CV-2">
Another follow up question. I need to get other values in the same row. How do I get that. the rendered html is as follows:
<td>
<span title="CV-2">
<input id="ctl00_ctl00_ctl00_ctl00_BodyPlaceHolder_ContentPlaceHolder_ContentPlaceHolder_mainContentPlaceHolder_ucArchitectureFile_ucArchitectureFileGrid2_rgArchitectureFiles_ctl00_ctl05_IncludeFileCheckBox" type="checkbox" checked="checked" name="ctl00$ctl00$ctl00$ctl00$BodyPlaceHolder$ContentPlaceHolder$ContentPlaceHolder$mainContentPlaceHolder$ucArchitectureFile$ucArchitectureFileGrid2$rgArchitectureFiles$ctl00$ctl05$IncludeFileCheckBox">
</span>
<input id="ctl00_ctl00_ctl00_ctl00_BodyPlaceHolder_ContentPlaceHolder_ContentPlaceHolder_mainContentPlaceHolder_ucArchitectureFile_ucArchitectureFileGrid2_rgArchitectureFiles_ctl00_ctl05_hiddenArchitectureFileId" type="hidden" value="3115" name="ctl00$ctl00$ctl00$ctl00$BodyPlaceHolder$ContentPlaceHolder$ContentPlaceHolder$mainContentPlaceHolder$ucArchitectureFile$ucArchitectureFileGrid2$rgArchitectureFiles$ctl00$ctl05$hiddenArchitectureFileId">
</td>
What follow up api should I call to get the span title "CV_2" and also the value="3115" in the input.
I am new to using javascript. thank you for your help.
</td>
What follow up api should I call to get the span title "CV_2" and also the value="3115" in the input.
I am new to using javascript. thank you for your help.
0
Shinu
Top achievements
Rank 2
answered on 01 Apr 2013, 12:38 PM
Hi,
Try the following javascript.
JS:
Thanks,
Shinu
Try the following javascript.
JS:
function
onclick() {
var
masterTable = $find(
"<%= RadGrid1.ClientID %>"
).get_masterTableView();
var
row = masterTable.get_dataItems();
for
(
var
i = 0; i < row.length; i++)
{
var
input=masterTable.get_dataItems()[i].findElement(
"input1"
);
}
}
Thanks,
Shinu
0
kunigiri
Top achievements
Rank 1
answered on 16 Dec 2015, 10:46 AM
Hi
i am using this code but i am not getting the Mastertable view data. it is showing error.undefined.my requirement is i am having telerik gird with check box and bound column , on submit click for that page i need to check whether the check box is clicked or not , if no check box does not checked then need alert message. please help me in this as soon possible.
Thanks
indraja
0
Hi Кunigiri,
You can traverse the grid items and once you have a reference to the the grid item within the for loop, you can use findElement or findControl methods to get the checkBox or simply use the get_selected() method:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/hierarchical-grid-types-and-load-modes/traversing-detail-tables#looping-through-the-detail-tablesitems-in-telerik-radgrid-on-the-client
I am also sending a sample RadGrid web site to demonstrate a practical implementation with findControl() and findElement() methods. Please examine the attached application and let me know if it helps you.
Regards,
Eyup
Telerik
You can traverse the grid items and once you have a reference to the the grid item within the for loop, you can use findElement or findControl methods to get the checkBox or simply use the get_selected() method:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/hierarchical-grid-types-and-load-modes/traversing-detail-tables#looping-through-the-detail-tablesitems-in-telerik-radgrid-on-the-client
I am also sending a sample RadGrid web site to demonstrate a practical implementation with findControl() and findElement() methods. Please examine the attached application and let me know if it helps you.
Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items