i have bit tricky kind or problem. i need to get values of each textbox in loop with different names,i have three row (name,telephone,email)and off course three textbox ,can any one help how to get in loop ,i need to insert them in database

Dim arr() As String
            Dim record As Int32
            record = 0
            For Each div As System.Web.UI.Control In plholder.Controls
                If div.[GetType]().Name = "HtmlGenericControl" Then
                    Dim hml As HtmlGenericControl = DirectCast(div, HtmlGenericControl)

                    Dim str12 As String
                    str12 = hml.TagName
                    str12 = hml.ID

                    For Each table As System.Web.UI.Control In div.Controls

                        If table.[GetType]().Name = "HtmlTable" Then

                            Dim htab As HtmlTable = DirectCast(table, HtmlTable)

                            Dim str13 As String
                            str13 = htab.TagName
                            str13 = htab.ID

                            For Each row As System.Web.UI.Control In table.Controls

                                Dim hrow As HtmlTableRow = DirectCast(row, HtmlTableRow)

                                Dim str14 As String
                                str14 = hrow.TagName
                                str14 = hrow.ID

                                For Each cell As System.Web.UI.Control In row.Controls

                                    Dim hcell As HtmlTableCell = DirectCast(cell, HtmlTableCell)
                                    Dim str15 As String
                                    str15 = hcell.TagName
                                    str15 = hcell.ID

                                    For Each textbox As System.Web.UI.Control In cell.Controls

                                        If textbox.GetType Is GetType(WebControls.TextBox) Then

                                            Dim tbox As TextBox = CType(textbox, System.Web.UI.Control)
                                            Dim str16, str17 As String
                                            str16 = tbox.TextMode
                                            str16 = tbox.ID
                                            str17 = tbox.Text
                                        End If
                                    Next 'textbox
                                Next 'cell
                            Next 'row

                        End If
                    Next 'table

                End If
            Next 'div

I need to insert multiple columns after grabbing values from textboxes(values are in variable str17 ) in loop .

but them ain problem is that values are getting one by one ..

code is in c#

str17 = (((TextBox)Tablename.Rows[i].Cells[j].Controls[0]).Text).ToString()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.