|
Hi
I have a repeater with a textbox inside it, I need to update my table with the value in this textbox, the problem is that i can't refer to these textboxes, I tried to use a non constant ID for the textBox as in the following Code:
<asp:Repeater id="repContact" runat="server">
<ItemTemplate>
<asp:textbox name='txtContactInfo_"<%# Container.DataItem("CategoryID")%>"' runat="server" />
</ItemTemplate> </asp:Repeater>
Code behind:
Dim newtb As TextBox = new TextBox()
strSQL = "Select CategoryID " _
& "From ContactInfo " _
& "Where CategoryID = " & iID
myCommand = New OleDbCommand (strSQL, objConn)
dataReader = myCommand.ExecuteReader()
Do While dataReader.Read()
newtextboxname = ("CategoryID")
newtb.ID = "txtContactInfo_" + newtextboxname
Dim myComm As OleDbCommand = New OleDbCommand (strSQL,dbConn)
strSQL = "Update ContactInfo " _
& "Set ContactInfo = '" & newtb.Text.Trim() & "' " _
& "Where CategoryID = " & iID
myComm.CommandText = strSQL
myComm.ExecuteNonQuery()
myComm.Cancel()
Loop
dataReader.Close()
What is the problem with this code?, i wonder if the problem was in defining the textbox ID.
Thanks for helping
|
|
|
|
|
|
|
// |