N
nasirmajor
dear all,
i have a datagrid with checkboxes for selection of rows. and want to
get unique id/ids(job_code) from the selected rows in array etc.
can anyone help.
<asp:datagrid id="dgResults" runat="server" DataKeyField="job_code">
<Columns>
<asp:TemplateColumn>
<ItemStyle Width="30px"></ItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkCol" Runat="server">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
-----------
-----------
private void imgSubmit_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
int a = 0;
DataGridItemCollection items=dgResults.Items;
for (int i=0; i<items.Count; i++)
{
CheckBox cb= (CheckBox)items.FindControl("chkCol");
if ((cb != null) && cb.Checked)
{
a += 1;
// need to get IDs from datagrid for the rows which are
selected with checkbox
}
}
}
thanks in advance
i have a datagrid with checkboxes for selection of rows. and want to
get unique id/ids(job_code) from the selected rows in array etc.
can anyone help.
<asp:datagrid id="dgResults" runat="server" DataKeyField="job_code">
<Columns>
<asp:TemplateColumn>
<ItemStyle Width="30px"></ItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkCol" Runat="server">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
-----------
-----------
private void imgSubmit_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
int a = 0;
DataGridItemCollection items=dgResults.Items;
for (int i=0; i<items.Count; i++)
{
CheckBox cb= (CheckBox)items.FindControl("chkCol");
if ((cb != null) && cb.Checked)
{
a += 1;
// need to get IDs from datagrid for the rows which are
selected with checkbox
}
}
}
thanks in advance