title: How to Add a discrete row to gridview
body: <p>I am binding the gridview and showing their corresponding total in footer without any error. Now I want to add extra runs as below highlighted in image(which is completely discrete datarow and it does not belong to dataset).I want to achieve functionality like below Image.</p>
  
  <p><img src="https://i.stack.imgur.com/2yOOg.png" alt="enter image description here"></p>
  
  <p>Here is my code :</p>
  
  <pre><code>&lt;asp:GridView ID="gvFirstInningBatting" runat="server" AllowSorting="True" AutoGenerateColumns="false"
          GridLines="None" AllowPaging="false" CellPadding="4" CssClass="GridViewStyle" OnRowDataBound="gvFirstInningBatting_RowDataBound"
          ShowFooter="true" ShowHeader="true" Width="100%"&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="P_PlayerPopulerName" HeaderText="Batting" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" /&gt;
              &lt;asp:BoundField DataField="SBTS_PlayerStatus" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" /&gt;
              &lt;asp:BoundField DataField="SBTS_RunsScored" HeaderText="R" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" /&gt;
              &lt;asp:BoundField DataField="SBTS_MinutesBatted" HeaderText="M" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" /&gt;
              &lt;asp:BoundField DataField="SBTS_BallsPlayed" HeaderText="B" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" /&gt;
              &lt;asp:BoundField DataField="SBTS_Fours" HeaderText="4s" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" /&gt;
              &lt;asp:BoundField DataField="SBTS_Sixes" HeaderText="6s" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" /&gt;
              &lt;asp:BoundField DataField="SBTS_StrikeRate" HeaderText="SR" HeaderStyle-HorizontalAlign="Center"
                  ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" /&gt;
          &lt;/Columns&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>In C#</p>
  
  <pre><code>protected void BindGridView(int scheduleId)
          {
              SqlConnection dBConnection = null;
              try
              {
                  dBConnection = new SqlConnection();
                  dBConnection.ConnectionString = ConfigurationManager.ConnectionStrings["***"].ConnectionString;
                  SqlDataAdapter dataAdapter = new SqlDataAdapter();
  
                  SqlCommand cmd = new SqlCommand("SP_NAME", dBConnection);
                  cmd.CommandType = CommandType.StoredProcedure;
                  dBConnection.Open();
  
                  DataSet ds = new DataSet();
                  DataTable dtBatting = new DataTable();
                  dataAdapter.SelectCommand = cmd;
                  dataAdapter.Fill(ds);
  
                  int gvBattingCount = Convert.ToInt32(cmd.Parameters["@BattingRowsCount"].Value);
  
                  for (int i = 0; i &lt; gvBattingCount; i++)
                  {
                      if (ds.Tables[i].Rows.Count &gt; 0)
                      {
                          if (i == 0)
                          {
                              DataRow dr1st;
  
                              ds.Tables[i].DefaultView.RowFilter = "SBTS_PlayerIsBatted = 1";
                              dtBatting = ds.Tables[i].DefaultView.ToTable();
  
                              dr1st = dtBatting.NewRow();
                              dr1st["P_PlayerPopulerName"] = " ";
                              dr1st["SBTS_RunsScored"] = 36;
  
                              dr1st["SBTS_PlayerStatus"] = "Extras";
                              dr1st["SBTS_MinutesBatted"] = 0;
                              dr1st["SBTS_BallsPlayed"] = 0;
                              dr1st["SBTS_Fours"] = 0;
                              dr1st["SBTS_Sixes"] = 0;
                              dr1st["SBTS_StrikeRate"] = 0;
                              dtBatting.Rows.Add(dr1st);
  
                              gvFirstInningBatting.DataSource = dtBatting;
                              gvFirstInningBatting.DataBind();
                          }
                      }
                  }
             }
  </code></pre>
  
  <p>the grid is working if I use <code>dr1st["SBTS_Sixes"] = 0;</code> but it shows 0 in the row and if I use <code>dr1st["SBTS_Sixes"] = DBNull.Value;</code> then it is throwing error </p>
  
  <blockquote>
    <p>Object cannot be cast from DBNull to other types.</p>
  </blockquote>
  
  <p>What should I do, Please help me out.</p>