completato comportamento checkbox selezione
This commit is contained in:
@@ -223,7 +223,7 @@
|
||||
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="chkSelect" runat="server" />
|
||||
<asp:CheckBox ID="chkSelect" runat="server" OnCheckedChanged="btnSel_Click" AutoPostBack="true" />
|
||||
</ItemTemplate>
|
||||
<HeaderTemplate>
|
||||
<asp:CheckBox ID="btnSelAll" runat="server" Checked="false" ToolTip='<%# traduci("btnSelAll") %>'
|
||||
|
||||
@@ -233,15 +233,38 @@ namespace C2P.WebUserControls
|
||||
if (!isChecked)
|
||||
{
|
||||
chkbox.ToolTip = traduci("btnSelAll");
|
||||
numSel = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
chkbox.ToolTip = traduci("btnDeselAll");
|
||||
numSel = grView.Rows.Count;
|
||||
}
|
||||
foreach (GridViewRow riga in grView.Rows)
|
||||
{
|
||||
((CheckBox)riga.FindControl("chkSelect")).Checked = isChecked;
|
||||
}
|
||||
setBtnVisib();
|
||||
}
|
||||
/// <summary>
|
||||
/// gestione singolo click
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSel_Click(object sender, EventArgs e)
|
||||
{
|
||||
// seleziono tutti i valori visibili nel datagrid
|
||||
CheckBox chkbox = ((CheckBox)sender);
|
||||
bool isChecked = chkbox.Checked;
|
||||
if (isChecked)
|
||||
{
|
||||
numSel++;
|
||||
}
|
||||
else
|
||||
{
|
||||
numSel--;
|
||||
}
|
||||
setBtnVisib();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user