title: Compute the ReadOnly column in real time in gridview and save the computed value to SQL Server
body: <p>I am trying to compute the column in real time meaning the calculation should be seen before an edit link is clicked. The <strong>weight first half</strong> is already found in the gridview. </p>
  
  <p>The gridview is then edited to add the <strong>rating first half</strong>. the 2, <strong>weight first half</strong> and <strong>rating first half</strong> needs to be multiplied to get the result that is <strong>score first half</strong> and <strong>score first half</strong> I made it a ReadOnly. </p>
  
  <p>Now I want the <strong>score first half</strong> to be saved in the SQL Server database. Mind you I already have the update command that the <code>SqlDataSource</code> generates.</p>
  
  <p>Here is my markup:</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" 
                AutoGenerateColumns="False" 
                DataKeyNames="P_C_ID" 
                DataSourceID="SqlDataSource1"&gt;
    &lt;Columns&gt;
      &lt;asp:CommandField ShowEditButton="True" /&gt;
      &lt;asp:TemplateField HeaderText="P_C_ID" 
                         InsertVisible="False" SortExpression="P_C_ID"&gt;
        &lt;EditItemTemplate&gt;
          &lt;asp:Label ID="Label1" 
                     runat="server" 
                     Text='&lt;%# Eval("P_C_ID") %&gt;'&gt;
          &lt;/asp:Label&gt;
        &lt;/EditItemTemplate&gt;
        &lt;ItemTemplate&gt;
          &lt;asp:Label ID="Label1" 
                     runat="server" 
                     Text='&lt;%# Bind("P_C_ID") %&gt;'&gt;
          &lt;/asp:Label&gt;
        &lt;/ItemTemplate&gt;
        &lt;asp:TemplateField HeaderText="WEIGHT_FIRST_HALF" 
                           SortExpression="WEIGHT_FIRST_HALF"&gt;
          &lt;EditItemTemplate&gt;
            &lt;asp:TextBox ID="TextBox5" 
                         runat="server" 
                         ReadOnly="True" 
                         Text='&lt;%# Bind("WEIGHT_FIRST_HALF") %&gt;'&gt;
            &lt;/asp:TextBox&gt;
          &lt;/EditItemTemplate&gt;
          &lt;ItemTemplate&gt;
            &lt;asp:Label ID="Label6" 
                       runat="server" 
                       Text='&lt;%# Bind("WEIGHT_FIRST_HALF") %&gt;'&gt;
            &lt;/asp:Label&gt;
          &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;ItemTemplate&gt;
          &lt;asp:Label ID="Label9" 
                     runat="server" 
                     Text='&lt;%# Bind("SCORE_FIRST_HALF") %&gt;'&gt;
          &lt;/asp:Label&gt;
        &lt;/ItemTemplate&gt;  
      &lt;/Columns&gt;
    &lt;/asp:GridView&gt;
    &lt;asp:SqlDataSource ID="SqlDataSource1" 
                       runat="server" 
                       ConnectionString="&lt;%$ ConnectionStrings:AWPConnectionString5 %&gt;"
                       UpdateCommand="UPDATE [Performance_Rating_2] SET [WEIGHT FIRST HALF] = @WEIGHT_FIRST_HALF, [RATING FIRST HALF] = @RATING_FIRST_HALF, [SCORE FIRST HALF], [RATING FIRST HALF] = @RATING_FIRST_HALF = @SCORE_FIRST_HALF WHERE [P_C_ID] = @P_C_ID"&gt;
      &lt;asp:Parameter Name="WEIGHT_FIRST_HALF" 
                     Type="Decimal" /&gt;
      &lt;UpdateParameters&gt;
        &lt;asp:Parameter Name="RATING_FIRST_HALF" 
                       Type="Int32" /&gt;
        &lt;asp:Parameter Name="SCORE_FIRST_HALF" 
                       Type="Decimal" /&gt;
      &lt;/UpdateParameters&gt;
  </code></pre>
  
  <p>Okay folks the program is long. I just took part that is not working fine. But should you need clarity do not hesitate to ask for clarity. Right now only the weight and rating is being saved. the computed is not saved at all. I actually do not want to write it in C# codes as I need results in real time</p>