cokedev Posted January 28, 2004 Posted January 28, 2004 OK I have generated a number of textboxes on page load depending on the numer of enterys i have. What i have gotten stuck on is when i submit my form how can i check for my values using a loop? ie: my textboxes or generated tb1,tb2,tb3....etc how can use that in a loop like: Do While i = intEnteryTotal datafield("item") = tb Loop ----------------------------------------------------------------------------------- Public Function load_desc() Dim strSQL As String = "SELECT * FROM tblDESCREP" Dim myConn As New OleDb.OleDbConnection(strProvider) Dim myDC As New OleDb.OleDbCommand(strSQL, myConn) myConn.Open() Dim objRdr As OleDb.OleDbDataReader = myDC.ExecuteReader Dim intI As Integer = 1 Dim intR As Integer Response.Write("<Table><tr><td>Descrepancy Name</td><td align=""center"">Pass</td><td align=""center"">Fail</td><td>Descrepancy Name</td><td align=""center"">Pass</td><td align=""center"">Fail</td></tr><tr>") Do While objRdr.Read intR = intI Mod 2 If intR = 1 Then Response.Write("</tr><tr>") End If Response.Write("<td style=""WIDTH: 225px"">") If objRdr.Item("DESCREP_MAJOR") = True Then Response.Write("<b>") End If Response.Write(objRdr.Item("DESCREP_NAME")) If objRdr.Item("DESCREP_MAJOR") = True Then Response.Write("</b>") End If Response.Write("</td>") Response.Write("<td style=""WIDTH: 30px"" align=""center""><INPUT Name=""d" & objRdr.Item("DESCREP_ID") & """ type=""radio"" value=""True"" CHECKED></td>") Response.Write("<td style=""WIDTH: 50px"" align=""center""><INPUT Name=""d" & objRdr.Item("DESCREP_ID") & """ type=""radio"" value=""False""></td>") intI += 1 Loop Response.Write("</tr></Table>") myConn.Close() End Function ------------------------------------------------------------------------------- Quote
bungpeng Posted January 29, 2004 Posted January 29, 2004 I saw your source, you should be using 'radio button', not 'textbox' right? If you are using radio button, you can use the same name for all radio button, then use "request.form("rdoName")" to get your value for radio button. P/S: If your case are multiple choices, then you should use 'checkbox' rather than radio button Quote
*Gurus* Derek Stone Posted January 29, 2004 *Gurus* Posted January 29, 2004 Loop through the page's Form collection. Quote Posting Guidelines
*Gurus* Derek Stone Posted January 30, 2004 *Gurus* Posted January 30, 2004 The following assumes that the generated controls have names prefixed with "ctlGenerated". Dim item As String For Each item In Request.Form If item.IndexOf("ctlGenerated") = 0 Then 'This item is a generated control End If Next Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.