Hi,
I have used a repeater to gain the data for a users details, this works fine, it places the correct data into the asp:textbox-es
But I need to take the info from these textbox, and use an update sql statement to update the database with any changes (if required)
the problem I get is that it says that the txtbox name are not ceclared, I know this is somthing to do with that the txtboxes are in a repeater, but is there a way to grab the data from them?
here is the HTML for the repeater:
and here is my sub for the update button:Code:<asp:Repeater id="rep_Profile" runat="server"> <ItemTemplate> <table style="WIDTH: 521px; HEIGHT: 362px" height="362" width="521"> <tbody> <tr> <td> Username:</td> <td> <asp:TextBox id="txt_UserName" disabled="disabled" width="202" runat="server" Text='<%# Container.DataItem("Username")%>'></asp:TextBox> </td> </tr> <tr> <td> Forenames:</td> <td> <asp:TextBox id="txt_ForeNames" width="202px" runat="server" text='<%# Container.DataItem("Forenames")%>'></asp:TextBox> </td> </tr> <tr> <td> Surname:</td> <td> <asp:TextBox id="txt_Surname" width="202px" runat="server" Text='<%# Container.DataItem("Surname")%>'></asp:TextBox> </td> </tr> <tr> <td> Address:</td> <td> <asp:TextBox id="txt_Address1" width="202px" runat="server" Text='<%# Container.DataItem("HouseNo")%>'></asp:TextBox> </td> </tr> <tr> <td></td> <td> <asp:TextBox id="txt_Address2" width="202px" runat="server" Text='<%# Container.DataItem("StreetName")%>'></asp:TextBox> </td> </tr> <tr> <td></td> <td> <asp:TextBox id="txt_Address3" width="202px" runat="server" Text='<%# Container.DataItem("City")%>'></asp:TextBox> </td> </tr> <tr> <td></td> <td> <asp:TextBox id="txt_Address4" width="202px" runat="server" Text='<%# Container.DataItem("District")%>'></asp:TextBox> </td> </tr> <tr> <td> Postcode:</td> <td> <asp:TextBox id="txt_PostCode" width="202px" runat="server" Text='<%# Container.DataItem("PostCode")%>'></asp:TextBox> </td> </tr> <tr> <td> E-Mail:</td> <td> <asp:TextBox id="txt_Email" width="202px" runat="server" Text='<%# Container.DataItem("eMail")%>'></asp:TextBox> </td> </tr> <tr> <td> <p> Recieve NewsLetter: </p> </td> <td> <asp:CheckBox id="chk_News" runat="server" Checked='<%# Container.DataItem("News")%>'></asp:CheckBox> Check if you wosh to recieve the Orctions News Letter </td> </tr> </tbody> </table> </ItemTemplate> </asp:Repeater>
VB Code:
Sub imgcmd_UpdateProf_Click(sender As Object, e As ImageClickEventArgs) Dim MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & _ server.mappath("cgi-bin/db/orctions.mdb")) Dim CommandText As String = "UPDATE tbl_Users SET Surname ='" & txt_Surname.text & "', Forenames ='" & txt_Forenames.text & "', HouseNo ='" & txt_Address1.text & "', StreetName ='" & txt_Address2.text & "', City='" & txt_Address3.text & "', District='" & txt_Address4.text & "', Postcode='" & txt_Postcode.text & "', eMail='" & txt_Email.text & "', News='" & txt_News.text & "' Where Username='" & Session("Username") & "'" Dim myCommand As New OleDBCommand(CommandText, myConnection) myConnection.Open() myConnection.Close() End Sub
any help?




Reply With Quote