Results 1 to 2 of 2

Thread: Repeater problems

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    271

    Repeater problems

    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:

    Code:
    <asp:Repeater id="rep_Profile" runat="server">
                                                <ItemTemplate>
                                                    <table style="WIDTH: 521px; HEIGHT: 362px" height="362" width="521">
                                                        <tbody>
                                                            <tr>
                                                                <td>
                                                                    &nbsp;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>
    and here is my sub for the update button:

    VB Code:
    1. Sub imgcmd_UpdateProf_Click(sender As Object, e As ImageClickEventArgs)
    2.  
    3. Dim  MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & _
    4.         server.mappath("cgi-bin/db/orctions.mdb"))
    5.   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") & "'"
    6.  
    7.    Dim myCommand As New OleDBCommand(CommandText, myConnection)
    8.        myConnection.Open()
    9.        myConnection.Close()
    10.  
    11.  
    12. End Sub

    any help?
    §tudz

    Studzworld.com - Portfolio

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    I was also trying to do this a while back but i never found a solution, so i ended up creating a table dynamically in code and adding it to a place holder.

    If you manage to solve it could you post your solution on here please?

    Tom.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width