Hi
I have made a datagrid(cols: emp_code, from_date) where last col contains checkboxes. I am try
to get the application ids for the check boxes that are checked on the click of the button but could not make it.
Here's the code m using...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dgitem As DataGridItem
Dim chk As CheckBox
Dim aid As String
For Each dgitem In applications.Items
chk = dgitem.FindControl("chksel")
If (chk.Checked) Then
aid = CType(dgitem.FindControl("a"), Label).Text
lblsel.Text = aid
Response.Write(aid)
End If
Next
End Sub
n here's d html code:
<form id="Form1" method="post" runat="server">
<asp:datagrid id="applications" style="Z-INDEX: 101; LEFT: 124px; POSITION: absolute; TOP: 129px" runat="server" AutoGenerateColumns="False" Height="140px" Width="443px">
<Columns>
<asp:boundColumn headertext="emp_code" DataField="emp_code"></asp:boundColumn>
<asp:BoundColumn DataField="start_date" HeaderText="from"></asp:BoundColumn>
<asp:BoundColumn DataField="application_id" HeaderText="appid" Visible="False"></asp:BoundColumn>
<asp:boundColumn headertext="appid" Visible="False"></asp:boundColumn>
<asp:TemplateColumn headertext="aid" Visible="False">
<ItemTemplate>
<asp:Label ID="a" text='<%3databinder.eval(container.dataitem,"aplli cation_id")%>' Runat=server />
</ItemTemplate>
</asp:TemplateColumn>
<asp:templateColumn headertext="check">
<ItemTemplate>
<asp:CheckBox ID="chksel" Runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:templateColumn>
</Columns>
</asp:datagrid><asp:button id="Button1" style="Z-INDEX: 102; LEFT: 315px; POSITION: absolute; TOP: 341px" runat="server" Height="27px" Width="100px" Text="Button"></asp:button></form>
Pls help me what m doing wrong..............
Regards,
AShima