i already posted this question.Sorry that i failed to add any code.That thread is closed. Apologies. I’m bothering you all again.
Anyways, i just want to identify checkboxes of a specific columns in a radgrid? i have two columns. and two buttons.if i click one button i need to check/uncheck checkboxes of that particular column alone.Kind help please?i already tried this. Now all checkboxes in the grid are getting checked/unchecked.
Please find the code below.
var inputs = document.getElementsByTagName("input"); //or document.forms[0].elements;
for (var i = 0; i < input.length; i++)
{
if (input[i].type == "checkbox")
{
if (input[i].checked) {
input[i].checked = false;
}
else
{
input[i].checked = true;
}
}
}
Please tell me on how can i pick check boxes of a particular column alone?
HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script language="javascript" type="text/javascript">
function clickbutton()
{
debugger;
var inputs = document.getElementsByTagName("input"); //or document.forms[0].elements;
for (var i = 0; i < input.length; i++)
{
if (input[i].type == "checkbox")
{
if (input[i].checked) {
input[i].checked = false;
}
else
{
input[i].checked = true;
}
}
}
}
</script>
</head>
<body class="BODY">
<form id="mainForm" method="post" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<!-- content start -->
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="clrFilters">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
<telerik:AjaxUpdatedControl ControlID="clrFilters" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="False"
AllowSorting="True" ClientSettings-Scrolling-AllowScroll="true"
AllowFilteringByColumn="True" Width="1251px" runat="server" OnColumnCreating="RadGrid1_ColumnCreating"
OnItemCommand="RadGrid1_ItemCommand"
OnNeedDataSource="RadGrid1_NeedDataSource" Skin="Gray"
OnItemDataBound="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated"
>
<FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<AlternatingItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<PagerStyle Mode="NumericPages" />
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
</MasterTableView>
<SelectedItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ClientSettings>
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="True"></Scrolling>
</ClientSettings>
<FilterMenu EnableTheming="True">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
<EditItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ActiveItemStyle HorizontalAlign="Right" VerticalAlign="Middle" />
<FilterItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:RadGrid>
<br />
<p>
</p>
</form>
</body>
</html>
I m creating Checkboxes and Button dynamically.
Think like these are more easely done using JQuery.
But nevertheless… if the
inputtags are really alternating each other, then you can pseudo-select them using a modulo operation.Made an example:
http://jsfiddle.net/gnRQj/