Hi! I'm using C# and SQL Server.
I need to take data from one table, display it to the user, allow the user to modify anything, and then when they click save, have the record added to a new table and deleted from the old.
I have the first table display minimal data in the GridView. When the patron selects the GridView record, I display the full information and a few more controls in a FormView. The user is then able to modify those controls as they wish. I have used the Edit Item Template to display the information.
I've got this working fine. I'm just not sure how I can take that data, add it as a new row into a DB, and delete the old.
I was going to try adding a button to the FormView, and in it's click procedure, inserting and deleting the record. But I cannot figure out how to reference each control in order to do this.
Say I had these fields in the Edit Itemp Template of a FormView called fvUser
<asp:TextBox ID="IDNum" runat="server" Text='<%# Bind("IDNum") %>'></asp:TextBox>
<asp:TextBox ID="txtLN" runat="server" Text='<%# Bind("LN") %>'></asp:TextBox>
<asp:TextBox ID="txtFN" runat="server"></asp:TextBox>
<asp:TextBox ID="txtDOB" runat="server"></asp:TextBox>
<asp:Button ID="btnChangeUser" runat="server" onclick="btnChangeUser_Click" />
I want the user to be able to modify everything.
And then, this in the code behind.
protected void btnChangeUser_Click(object sender, EventArgs e)
{
}
I'm not sure how I can reference the controls in the code behind
Thank you.