Dynamically Generated TextBox.Text , how do i pick the value up

Dynamically Generated TextBox.Text , how do i pick the value up

Post by Sean » Thu, 29 May 2003 08:33:42


I am generating textbox on the fly and I need to read them into a stored procedure.

I am generating the textboxes by reading it off from an xml file.

for example,

While (reader.MoveToNextAttribute())
 txtworkBox = New TextBox()
 txtworkBox.ID = reader.Name & "work" & workcount
 txtworkBox.Text = reader.Value
 ' ------------------------------Calling Stored Procedure
                Dim DS As DataSet
                Dim MyAdapter As New OracleDataAdapter()
                Dim MyCommand As New OracleCommand()
                Dim param1
                Dim param2
                Dim param3
                Dim param4

                Dim connectionString As String = "Data Source=" + ConnectionParams.datasource & _
                                                 ";User ID=" + ConnectionParams.username & _
                                                 ";Password=" + ConnectionParams.password
                oraConnection = New OracleConnection(connectionString)

                With MyCommand
                    .CommandText = "pack.sp_name"
                    .CommandType = CommandType.StoredProcedure
                    .Connection = oraConnection
                    .Parameters.Add(New OracleParameter(param1, OracleDbType.Double, 9, ParameterDirection.Input))
                    .Parameters.Add(New OracleParameter(param2, OracleDbType.Double, 2, ParameterDirection.Input))
                    .Parameters.Add(New OracleParameter(param3, OracleDbType.Double, 12, ParameterDirection.Input))
                    .Parameters.Add(New OracleParameter(param4, OracleDbType.Double, 20, ParameterDirection.Input))
                End With

                MyAdapter.InsertCommand = MyCommand

                With MyAdapter.InsertCommand
  ' ----------------------------------- i would love to pick the value of the textboxes here

                    .Parameters(param1).Value = ????.text
                    .Parameters(param2).Value = ????.text
                    .Parameters(param3).Value = ????.text
                    .Parameters(param4).Value = ????.text
                End With
                lbError.Text = "Record Inserted"
            Catch Exc As Exception
                lbError.Text = "<b>Error Message</b>: " & Exc.Message
            End Try

 ' ------------------------------Calling Stored Procedure
End While

When i see the View Source
<span id="lbwork">
 <input name="tag1work0" type="text" value="1000" id="tag1work0" />
 <input name="tag2work0" type="text" value="1" id="tag2work0" />
 <input name="tag3work0" type="text" value="5/27/2003 8:00 AM" id="tag3work0" />
 <input name="tag4work0" type="text" value="PENDING" id="tag4work0" />
 <input name="tag5work0" type="text" value="1000122" id="tag5work0" />
 <input name="tag1work1" type="text" value="10100" id="tag1work1" />
 <input name="tag2work1" type="text" value="1" id="tag2work1" />
 <input name="tag3work1" type="text" value="5/27/2003 8:00 AM" id="tag3work1" />
 <input name="tag4work1" type="text" value="PENDING" id="tag4work1" />
 <input name="tag5work1" type="text" value="1000122" id="tag5work1" />

My problem is how to i refer the textbox values in the stored procedure.

Any Help/Suggestion is greatly appreciated.

Thank You,