title: Create an Insert Parameter based off values of multiple fields - .NET
body: <p>I have an Insert screen which I want the values of two fields to be combined to create the value for a third field to be inserted as well. Currently I have a First and Last name field, as well as a Display name field (see below). The Display Name field should always be (First Name) + " " + (first letter of Last Name field). I want to save the user the hassle of having to manually type this in. How can I set the parameter "Dname" in the example below to take the value of the FName and LName fields and combine them for its value?</p>
  
  <pre><code>&lt;asp:FormView ID="testFormView" runat="server" DataKeyNames="ID" DataSourceID="testDataSource"&gt;
      &lt;InsertItemTemplate&gt;
          First Name: &lt;asp:TextBox ID="First_NameTextBox" runat="server" Text='&lt;%# Bind("FName") %&gt;' /&gt;
          &lt;br /&gt;
          Last Name: &lt;asp:TextBox ID="Last_NameTextBox" runat="server" Text='&lt;%# Bind("LName") %&gt;' /&gt;
          &lt;br /&gt;
          Display Name: &lt;asp:TextBox ID="Display_NameTextBox" runat="server" Text='&lt;%# Bind("DName") %&gt;' /&gt;
          &lt;asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"  /&gt;
      &lt;/InsertItemTemplate&gt;
  &lt;/asp:FormView&gt;
  &lt;asp:SqlDataSource ID="testDataSource" runat="server"
      InsertCommand="INSERT INTO [Users] ([FName], [LName], [DName]) VALUES (@FName, @LName, @DName)"&gt;
      &lt;InsertParameters&gt;
          &lt;asp:Parameter Name="FName" Type="String" /&gt;
          &lt;asp:Parameter Name="LName" Type="String" /&gt;
          &lt;asp:Parameter Name="DName" Type="String" /&gt;
      &lt;/InsertParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>I'm using C# in the code-behind.</p>