4
Sep

Grouping by CheckBoxList

Author: admin

.aspx page like this code below,…

<html>

<head runat=”server”>
<title>Grouping by CheckBoxList</title>

<script language=”javascript” type=”text/javascript”>
function Check(val)
{

document.getElementById(’HDNChecked’).value =val
}
</script>

</head>

<body>
<form id=”form1″ runat=”server”>
<asp:ScriptManager ID=”ScriptManager1″ runat=”server”>
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID=”UpdatePanel1″ runat=”server”>
<ContentTemplate>
<asp:CheckBoxList ID=”CheckBoxList1″ runat=”server” RepeatDirection=”Horizontal”
AutoPostBack=”true” OnSelectedIndexChanged=”CheckBoxList1_SelectedIndexChanged”>
<asp:ListItem Selected=”True” Value=”1″ onclick=”Check(’0′);”>Item1</asp:ListItem>
<asp:ListItem Value=”2″ onclick=”Check(’1′);”>Item2</asp:ListItem>
<asp:ListItem Value=”3″ onclick=”Check(’2′);”>Item3</asp:ListItem>
<asp:ListItem Value=”4″ onclick=”Check(’3′);”>Item4</asp:ListItem>
</asp:CheckBoxList>
<asp:HiddenField ID=”HDNChecked” runat=”server” Value=”" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>

</html>

Cobehind file .cs

protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
int IntSelect;
IntSelect = Convert.ToInt32(CheckBoxList1.SelectedItem.Value);
for (int i = 0; i <= CheckBoxList1.Items.Count – 1; i++)
{
CheckBoxList1.Items[i].Selected = false;
}
CheckBoxList1.Items[Convert.ToInt32(HDNChecked.Value)].Selected = true;
}

References : See also below link getting the Expression Examples in Reporting Services.

http://msdn.microsoft.com/en-us/library/ms157328.aspx

VN:F [1.7.4_987]
Rating: 5.0/5 (1 vote cast)
VN:F [1.7.4_987]
Rating: +1 (from 1 vote)