title: Gridview row doesn't save on Modification
body: <p>I have a <code>gridview</code> in which I insert one row for the first time and save it. Till this it works properly as expected.</p>
  
  <p>But when I see the saved data, and wanted to modify/Add one more data, I get error as</p>
  
  <blockquote>
    <p>Column 'EXP_TYPE_ID' does not belong to table .</p>
  </blockquote>
  
  <p>I don't know why it is giving me this error, as it saves properly whenever I add fresh record.</p>
  
  <p>Here is my Insert code.</p>
  
  <pre><code> protected void GrdPartyInfo_InsertCommand(object sender, GridRecordEventArgs e)
  {
      int iRowCount = 0;
  
      if (Session["partyInfo"] != null)
      {
          dtPartyInfo = (DataTable)Session["partyInfo"];
      }
      else
      {
          BindDataTable();
      }
  
      iRowCount = dtPartyInfo.Rows.Count;
      DataRow newRow = dtPartyInfo.NewRow();
      newRow["SR_NO"] = iRowCount + 1;
      newRow["EXP_TYPE_ID"] = Convert.ToString(e.Record["EXP_TYPE"]);
      newRow["EXP_TYPE"] = CF.ExecuteScaler2("Select Type_desc from type_mst where Type_Code = 'PAR' and Type_Abbr ='" + Convert.ToString(e.Record["EXP_TYPE"]) + "'").ToString();
      newRow["TITLE"] = Convert.ToString(e.Record["TITLE"]);
      newRow["F_NAME"] = Convert.ToString(e.Record["F_NAME"]);
      newRow["M_NAME"] = Convert.ToString(e.Record["M_NAME"]);
      newRow["L_NAME"] = Convert.ToString(e.Record["L_NAME"]);
      newRow["GENDER"] = Convert.ToString(e.Record["GENDER"]);
      newRow["EMAIL_ID"] = Convert.ToString(e.Record["EMAIL_ID"]);       
  
      newRow["MOB_NUM"] = Convert.ToString(e.Record["MOB_NUM"]);
  
      newRow["PAN_NO"] = Convert.ToString(e.Record["PAN_NO"]);
      newRow["ADHAAR_NO"] = Convert.ToString(e.Record["ADHAAR_NO"]);
      newRow["ADDRESS"] = Convert.ToString(e.Record["ADDRESS"]);
  
      dtPartyInfo.Rows.Add(newRow);
      GrdPartyInfo.DataSource = dtPartyInfo;
      GrdPartyInfo.DataBind();
      AddToViewState("GrdPartyInfo");
  }
  </code></pre>
  
  <p>and Aspx of gridview</p>
  
  <pre><code>&lt;cc1:Grid ID="GrdPartyInfo" AllowDataAccessOnServer="true" runat="server" CallbackMode="true"
                          Serialize="true" FolderStyle="../Styles/Grid/style_12" AllowAddingRecords="true"
                          AutoGenerateColumns="false" Width="100%" ShowFooter="true" ShowHeader="true"
                          OnInsertCommand="GrdPartyInfo_InsertCommand" OnRebind="GrdPartyInfo_Rebind" OnRowDataBound="GrdPartyInfo_RowDataBound"
                          OnUpdateCommand="GrdPartyInfo_UpdateCommand"&gt;
                          &lt;ClientSideEvents OnClientEdit="GrdPartyInfo_OnClientEdit" OnClientDblClick="GrdPartyInfo_OnClientDblClick" /&gt;
                          &lt;TemplateSettings RowEditTemplateId="tplRowEdit" /&gt;
                          &lt;Columns&gt;
                              &lt;cc1:Column ID="Column1" DataField="MKEY" ReadOnly="true" Width="0%" runat="server"
                                  Visible="false"&gt;
                                  &lt;TemplateSettings TemplateId="gtchkConfirm" HeaderTemplateId="HTConfirm" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column2" DataField="SR_NO" HeaderText="Sr No" Visible="true" Width="5%"&gt;
                                  &lt;TemplateSettings TemplateId="tplNumbering1" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column41" DataField="EXP_TYPE_ID" HeaderText="Expense Type" Visible="false"
                                  Width="10%"&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column3" DataField="EXP_TYPE" HeaderText="Expense Type" Visible="true"
                                  Width="10%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="cmbExpType" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column4" DataField="TITLE" HeaderText="Title" Visible="true" Width="6%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="cmbTitle" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column5" DataField="F_NAME" HeaderText="First Name" Visible="true"
                                  Width="8%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtFname" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column6" DataField="M_NAME" HeaderText="Middle Name" Visible="true"
                                  Width="9%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtMname" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column7" DataField="L_NAME" HeaderText="Last Name" Visible="true"
                                  Width="8%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtLName" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column8" DataField="GENDER" HeaderText="Gender" Visible="true" Width="7%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="cmbGender" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column22" DataField="EMAIL_ID" HeaderText="Email Id" Visible="true"
                                  Width="10%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtEmailid" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column23" DataField="MOB_NUM" HeaderText="Mob No" Visible="true"
                                  Width="8%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtMobNo" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column33" DataField="PAN_NO" HeaderText="Pan No" Visible="true" Width="8%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtPanno" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column34" DataField="ADHAAR_NO" HeaderText="Adhaar No" Visible="true"
                                  Width="9%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtAdhaar" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column35" DataField="ADDRESS" HeaderText="Address" Visible="true"
                                  Width="12%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="txtAddress" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                              &lt;cc1:Column ID="Column36" DataField="ATTACHMENT" HeaderText="Attachment" Visible="true"
                                  Width="8%"&gt;
                                  &lt;TemplateSettings RowEditTemplateControlId="FlAttach" RowEditTemplateControlPropertyName="value" /&gt;
                              &lt;/cc1:Column&gt;
                          &lt;/Columns&gt;
                          &lt;Templates&gt;
                              &lt;cc1:GridTemplate runat="server" ID="tplRowEdit"&gt;
                                  &lt;Template&gt;
                                      &lt;table class="rowEditTable"&gt;
                                          &lt;tr&gt;
                                              &lt;td valign="top"&gt;
                                                  &lt;fieldset style="width: 900px; height: 250px;"&gt;
                                                      &lt;legend&gt;Party Information&lt;/legend&gt;
                                                      &lt;table cellpadding="2" cellspacing="2" border="0"&gt;
                                                          &lt;tr&gt;
                                                              &lt;%--&lt;td&gt;
                                                                          Sr No:
                                                                      &lt;/td&gt;
                                                                      &lt;td&gt;
                                                                          &lt;input type="text" id="txtsrno" disabled="disabled" style="width: 150px;" class="ob_gEC" /&gt;
                                                                      &lt;/td&gt;--%&gt;
                                                              &lt;td&gt;
                                                                  Type:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;asp:DropDownList ID="cmbExpType" runat="server" DataSourceID="sd_Type" DataTextField="TYPE_DESC"
                                                                      DataValueField="TYPE_ABBR" Width="150px"&gt;
                                                                      &lt;asp:ListItem Value="--Select--"&gt;--Select--&lt;/asp:ListItem&gt;
                                                                  &lt;/asp:DropDownList&gt;
                                                              &lt;/td&gt;
                                                          &lt;/tr&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;
                                                                  Title:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;asp:DropDownList ID="cmbTitle" runat="server" DataSourceID="sd_Type_Title" DataTextField="TITLE"
                                                                      DataValueField="TITLE_CODE" Width="150px"&gt;
                                                                      &lt;asp:ListItem Value="--Select--"&gt;--Select--&lt;/asp:ListItem&gt;
                                                                  &lt;/asp:DropDownList&gt;
                                                              &lt;/td&gt;
                                                          &lt;/tr&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;
                                                                  First Name:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="text" id="txtFname" style="width: 150px; height: 18px; font-size: 11px;"
                                                                      class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  Middle Name:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="text" id="txtMname" style="width: 150px; height: 18px; font-size: 11px;"
                                                                      class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  Last Name:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="text" id="txtLName" style="width: 150px; height: 18px; font-size: 11px;"
                                                                      class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                          &lt;/tr&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;
                                                                  Gender:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;select id="cmbGender"&gt;
                                                                      &lt;option value="0" selected="selected"&gt;--Select--&lt;/option&gt;
                                                                      &lt;option value="Male"&gt;Male&lt;/option&gt;
                                                                      &lt;option value="Female"&gt;Female&lt;/option&gt;
                                                                  &lt;/select&gt;
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  Email Id:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="text" id="txtEmailid" style="width: 150px; height: 18px; font-size: 11px;"
                                                                      class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  Mobile No:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="text" id="txtMobNo" style="width: 150px; height: 18px; font-size: 11px;"
                                                                      class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                          &lt;/tr&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;
                                                                  Pan No:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="text" id="txtPanno" style="width: 150px; height: 18px; font-size: 11px;"
                                                                      class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  Adhaar No:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="text" id="txtAdhaar" style="width: 150px; height: 18px; font-size: 11px;"
                                                                      class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                          &lt;/tr&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;
                                                                  Address:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;%--&lt;input type="text" id="txtAddress" style="width: 150px;" class="ob_gEC"  /&gt;--%&gt;
                                                                  &lt;asp:TextBox ID="txtAddress" CssClass="ob_gEC" runat="server" Style="width: 240px;
                                                                      height: 50px; font-size: 11px;" TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt;
                                                              &lt;/td&gt;
                                                          &lt;/tr&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;
                                                                  Attachment:
                                                              &lt;/td&gt;
                                                              &lt;td&gt;
                                                                  &lt;input type="file" id="FlAttach" style="width: 250px; height: 18px;" class="ob_gEC" /&gt;
                                                              &lt;/td&gt;
                                                          &lt;/tr&gt;
                                                      &lt;/table&gt;
                                                  &lt;/fieldset&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td colspan="2" align="center"&gt;
                                                  &lt;input type="button" value="Save" onclick="GrdPartyInfo.save()" class="tdText" /&gt;
                                                  &lt;input type="button" value="Cancel" onclick="GrdPartyInfo.cancel()" class="tdText" /&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                      &lt;/table&gt;
                                  &lt;/Template&gt;
                              &lt;/cc1:GridTemplate&gt;
                          &lt;/Templates&gt;
                          &lt;Templates&gt;
                              &lt;cc1:GridTemplate runat="server" ID="tplNumbering1"&gt;
                                  &lt;Template&gt;
                                      &lt;b&gt;
                                          &lt;%# (Container.RecordIndex + 1) %&gt;&lt;/b&gt;
                                  &lt;/Template&gt;
                              &lt;/cc1:GridTemplate&gt;
                          &lt;/Templates&gt;
                      &lt;/cc1:Grid&gt;
  </code></pre>