samme
asked on
place textbox text into another textbox when button clicked in repeater
I am populating textbox2 with data from the database what i would like to try and do is populate textbox1 with text from textbox2 when button1 is clicked. This is what i have so far. I am not exactly sure the vb code should be. So the question is what should the vb code be?
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSourc e2">
<ItemTemplate>
<%-- <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>< br /><br />--%>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextB ox><br />
<asp:TextBox ID="TextBox2" runat="server" text='<%# Eval("ShipCity") %>'></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="edit" OnClick="Update" />
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSourc
<ItemTemplate>
<%-- <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><
<asp:TextBox ID="TextBox1" runat="server"></asp:TextB
<asp:TextBox ID="TextBox2" runat="server" text='<%# Eval("ShipCity") %>'></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="edit" OnClick="Update" />
</ItemTemplate>
</asp:Repeater>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Corrected like this: I had to take the new out
Protected Sub Repeater1_ItemCommand(ByVa l source As Object, ByVal e As System.Web.UI.WebControls. RepeaterCo mmandEvent Args) Handles Repeater1.ItemCommand
If (e.CommandName = "Update") Then
Dim TextFromTextBox2 As String = CType(e.Item.FindControl(" textbox2") , TextBox).Text
Dim txtTemp As TextBox = CType(e.Item.FindControl(" textbox1") , TextBox)
txtTemp.Text = TextFromTextBox2
End If
End Sub
Protected Sub Repeater1_ItemCommand(ByVa
If (e.CommandName = "Update") Then
Dim TextFromTextBox2 As String = CType(e.Item.FindControl("
Dim txtTemp As TextBox = CType(e.Item.FindControl("
txtTemp.Text = TextFromTextBox2
End If
End Sub
Sorry Samme,
I was too tired to see anything when I answered your question.
Glad you got it fixed
Good luck
Sammy
I was too tired to see anything when I answered your question.
Glad you got it fixed
Good luck
Sammy
ASKER
Ctype(e.Item.FindControl("
txtTemp.Text<---txtTemp not declared error