title: Hidden field in detailsview - aspnet membership userID
body: <p>I have a little detailsview where i can add some data to my DB.</p>
  
  <p>The detailsview's code:</p>
  
  <pre><code>&lt;asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
      DataSourceID="orderSqlDataSource" DefaultMode="Insert" Height="50px" 
      Width="333px" DataKeyNames="ID" CellPadding="4" ForeColor="#333333" 
      GridLines="None" oniteminserted="DetailsView1_ItemInserted" 
                  onprerender="DetailsView1_PreRender"&gt;
      &lt;CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /&gt;
      &lt;EditRowStyle BackColor="#E9ECF1" /&gt;
      &lt;FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" /&gt;
      &lt;Fields&gt;
          &lt;asp:BoundField DataField="userid" HeaderText="Azonosító" 
              SortExpression="userid" ReadOnly="True" /&gt;
          &lt;asp:BoundField DataField="quantity" HeaderText="Mennyiség (kg)" 
              SortExpression="quantity" /&gt;
          &lt;asp:TemplateField HeaderText="Mit rendel" SortExpression="Mit rendel"&gt;
              &lt;InsertItemTemplate&gt;
                  &lt;asp:DropDownList ID="ordertypeDropDownList" runat="server" 
                      DataSourceID="ordertypeDDLSqlDataSource" DataTextField="name" 
                      DataSource='&lt;%# Bind("ordertype") %&gt;'
                      SelectedValue='&lt;%# Bind("ordertype") %&gt;'
                      DataValueField="ID"&gt;
                  &lt;/asp:DropDownList&gt;
                  &lt;asp:SqlDataSource ID="ordertypeDDLSqlDataSource" runat="server" 
                      ConnectionString="&lt;%$ ConnectionStrings:dotnetConnectionString %&gt;" 
                      SelectCommand="SELECT [name], [ID] FROM [product]"&gt;&lt;/asp:SqlDataSource&gt;
              &lt;/InsertItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:CommandField ShowInsertButton="True" CancelText="Mégsem" 
              InsertText="Elküld" /&gt;
      &lt;/Fields&gt;
      &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
      &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
      &lt;PagerStyle BackColor="#284775" ForeColor="White" 
          HorizontalAlign="Center" /&gt;
      &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
  &lt;/asp:DetailsView&gt;
  </code></pre>
  
  <p>Here is the code behind for the page_load event:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          if (User.Identity.IsAuthenticated)
          {
              MembershipUser user = Membership.GetUser(User.Identity.Name);
              string userID = user.ProviderUserKey.ToString();
              ((TextBox)DetailsView1.Rows[0].Cells[1].Controls[0]).Text = userID;
          }
      }
  </code></pre>
  
  <p>As you can see i fill the first boundfield from the page_load.
  The problem is that the first boundfield (userid, or in my native language "azonosító") is important because of the database, but i don't want to let the user see his/her userid.
  If i make the boundfield hidden (visible=false), it won't be reachable with the code in the page_load.
  How can i bound the current userID to that field, when the field is hidden, or how can i get this work without boundfield for the ID?</p>
  
  <p>Thanks in advance!</p>