Hello,
I have a .aspx page (VB.NET) where there is the following table :
In the .vb file, I connect to a database and add some rows
This runs fine and add some rows to the table. Every row has the checkbox control and the id and name attributes of the checkbox are "ent_##".
My problem is : when I click on the save button, which is nothing more then a simple asp:button in the "form1" form, I have trouble finding all my checkboxes.
If I use something as :
I will be able to access the tableheaderrow (because it's static) but not a single other row (because they are added dynamically I guess?).
I cannot predict how many rows (and therefore checkboxes) I will add to the table. Is there a property or a method I could use to simply loop through all the submited controls, whether they are static or not ??
Thank you,
- Alexandre
I have a .aspx page (VB.NET) where there is the following table :
Code:
<asp:Table ID="mainTable" CssClass="tableList" runat="server"> <asp:TableHeaderRow CssClass="tableHeader"> <asp:TableHeaderCell>Type</asp:TableHeaderCell> <asp:TableHeaderCell>Task</asp:TableHeaderCell> <asp:TableHeaderCell>Length</asp:TableHeaderCell> <asp:TableHeaderCell>Done</asp:TableHeaderCell> </asp:TableHeaderRow> </asp:Table>
Code:
Dim mainTableRow As TableRow = New TableRow() ... Dim mainTableRowCell4 As TableCell = New TableCell() Dim checkBoxTemp As CheckBox = New CheckBox() checkBoxTemp.ID = "ent_" & dataReader.GetInt32(2).ToString mainTableRowCell4.Controls.Add(checkBoxTemp) mainTableRow.Cells.Add(mainTableRowCell4) mainTable.Rows.Add(mainTableRow)
My problem is : when I click on the save button, which is nothing more then a simple asp:button in the "form1" form, I have trouble finding all my checkboxes.
If I use something as :
Code:
Dim controlesEnum As IEnumerator controlesEnum = mainTable.Controls.GetEnumerator()
I cannot predict how many rows (and therefore checkboxes) I will add to the table. Is there a property or a method I could use to simply loop through all the submited controls, whether they are static or not ??
Thank you,
- Alexandre
Comment