Ah, Thanks Ricardo. That makes sense, but I'm still having trouble getting it to work. I guess I forgot to mention that the control is in a boundfield, if that makes a difference.
Here's the mainpage code:
<div align="center">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="RegistrationID" DataSourceID="SqlDataSourceFBReg"
DefaultMode="Insert" Height="50px"
Width="55%" OnItemInserted="NFLElim" >
<Fields>
<asp:BoundField DataField="RegistrationID" HeaderText="RegistrationID"
InsertVisible="False" ReadOnly="True" SortExpression="RegistrationID" />
<asp:BoundField DataField="UserName" HeaderText="One Season User Name"
SortExpression="UserName" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />...
And here's how I have the code behind setup:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class NFLElim_Reg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DetailsView1.DefaultMode = DetailsViewMode.Insert;
if (DetailsView1.FindControl("UserName") != null)
{
TextBox txt1 = (TextBox)DetailsView1.FindControl("UserName");
txt1.Text = User.Identity.Name.ToString();
}
}
}
protected void NFLElim(object sender, DetailsViewInsertedEventArgs e)
{
Response.Redirect("Account.aspx");
}
}
Hopefully I inserted the code correctly