<asp:GridView ID="GVAmountReceived" runat="server"DataKeyNames="sno" EmptyDataText="No Records Found"
Style="margin-bottom: 6px" BorderColor="#BDBDBD" AllowPaging="true" PageSize="20">
<columns>
<asp:templatefield headertext="S.No." footerstyle-horizontalalign="Center" itemstyle-horizontalalign="Center" xmlns:asp="#unknown">
<itemtemplate>
<%# Container.DataItemIndex + 1 %>
</itemtemplate>
</asp:templatefield>
<asp:boundfield headertext="Party Name" datafield="partyname" xmlns:asp="#unknown">
ItemStyle-HorizontalAlign="Center" ReadOnly="true" />
<asp:templatefield headertext="Date" itemstyle-horizontalalign="Center">
<edititemtemplate>
<asp:textbox runat="server" id="txt_date" width="90px"></asp:textbox>
<asp:calendarextender id="calrecdate" runat="server" targetcontrolid="txt_date" onclientdateselectionchanged="checkDate" format="dd/MM/yyyy" enabled="True" />
<asp:requiredfieldvalidator id="RFVrecdate" runat="server" controltovalidate="txt_date">
Display="None" ErrorMessage="Must Enter Date" ValidationGroup="duereport"></asp:requiredfieldvalidator>
<asp:validatorcalloutextender id="VCErecdate" runat="Server" targetcontrolid="RFVrecdate" />
</edititemtemplate>
</asp:templatefield>
<asp:commandfield showeditbutton="true" headertext="Edit" validationgroup="duereport" />
</asp:boundfield></columns>
.cs page like this
DataTable dtinsert = new DataTable();
TextBox txtrecdate = (TextBox)GVAmountReceived.Rows[e.RowIndex].Cells[3].Controls[1];
TextBox txtrecamount = (TextBox)GVAmountReceived.Rows[e.RowIndex].Cells[4].Controls[1];
TextBox txtchknumber = (TextBox)GVAmountReceived.Rows[e.RowIndex].Cells[5].Controls[1];
string partyname = Convert.ToString(GVAmountReceived.DataKeys[e.RowIndex].Values[0].ToString());
IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true);
String recdate1 = txtrecdate.Text.Trim().ToString();
DateTime recdate2 = DateTime.Parse(recdate1, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
objRetailPL.Amount = Convert.ToSingle(txtrecamount.Text.ToString());
objRetailPL.PartyName = partyname;
objRetailPL.Date = recdate2;
objRetailPL.Chequeno = txtchknumber.Text.ToString();
objRetailPL.username = Session["username"].ToString();
dtinsert = objRetailBAL.InsertReceivedAmount(objRetailPL);