Hi, all i want to do, is to know if a checkbox is checked or not in every row of my grid, with the grid of visualstudio 2005 i ran this code when i clicked a button
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
For index As Integer = 0 To Me.GridView1.Rows.Count - 1
Dim Valida As CheckBox = CType(Me.GridView1.Rows(index).FindControl("ColSel"), CheckBox)
If Valida.Checked Then
'do something
End If
Next
End Sub
in aspx i define the checkbox column like this
<telerik:GridTemplateColumn UniqueName="RevCol">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:GridTemplateColumn>
then i convert to vb this code, than you posted in some thread
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
{
CheckBox chk = (CheckBox)item.FindControl("CheckBox1");
if (chk.Checked)
{
Label lbl = (Label)item["Cool"].FindControl("Label1");
lbl.Text = DropDownList1.Text;
}
}
}
this is the result
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
For
Each item As Telerik.Web.UI.GridDataItem In RadGrid1.MasterTableView.Items
Dim chk As CheckBox = CType(item.FindControl("CheckBox1"), CheckBox)
If chk.Checked Then
'do something
End If
Next
End Sub
this code is running, but even with all rows checked in the command IF allways the result is false, can you help me please, what i doing wrong.
sorry for my english, i still working on it
Thanks in advanced...