multiple checkbox entry

admin

Administrator
Staff member
I have encountered problems on the coding.

I am using a data grid to display the users?information which is stored in the database and in the column of the checkbox. The user can check as many checkboxes at a time and after finish checking, the user will click on the 鎱恉it?button. The information of the checked box will then be stored onto a temporary table in database. There is a slight coding problem in which I cannot add the checked information onto the temporary table.

The code must be written under *.aspx.vb. Can anyone show me an example on the coding?

Thank you for your help.Here's an example i did before to delete data, hope it helps
<asp:datagrid id="DataGrid1" runat="server" autogeneratecolumns="False">
<columns>
<asp:boundcolumn datafield="id" readonly="True"></asp:boundcolumn>
<asp:boundcolumn datafield="fullname" headertext="Name"></asp:boundcolumn>
<asp:templatecolumn>
<itemtemplate>
<asp:checkbox id="fordeletion" runat="server"></asp:checkbox>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
Then you can create button in anywhere to add the data
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ditem As DataGridItem
For Each ditem In DataGrid1.Items
Dim chk As CheckBox = CType(ditem.FindControl("fordeletion"), CheckBox)
If Not IsNothing(chk) Then
If chk.Checked Then
'Code to Delete
End If
End If
Next
End SubCipher , really thank alot for your help
 
Back
Top