I want to delete selected record but it is giving me error--System.Web.HttpException: 'DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Id'.'
<asp:GridView ID="GridView1" runat="server" CssClass="mydatagrid" PagerStyle-CssClass="pager"
DataKeyNames="Id" HeaderStyle-CssClass="header" EmptyDataText="No Records Found"
RowStyle-CssClass="rows" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:BoundField DataField="Id" HeaderText="User ID" SortExpression="Id" ReadOnly="True"
ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" InsertVisible="False"
Visible="false" />
<asp:BoundField DataField="sname" HeaderText="User Name" SortExpression="sname" ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="date" HeaderText="Booked Date" SortExpression="date" ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" Visible="false" />
<asp:BoundField DataField="spmail" HeaderText="Service Provide Email" SortExpression="spmail"
ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="status" HeaderText="Status" SortExpression="status" ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="slot" HeaderText="Time Slot" SortExpression="slot" ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" Text="Delete" ImageUrl="~/Images/delete.png"
Width="50px" Height="50px" CommandArgument='<%# Eval("Id") %>' CommandName="Deleterow" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
void FillGrid2()
{
string constr = ConfigurationManager.ConnectionStrings["Q_SS_regnConnectionString1"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("select Id,sname,date,spmail,status,slot from Booking where semail='" + Session["mail"].ToString() + "' and status='UnApproved'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Deleterow")
{
string id = e.CommandArgument.ToString();
string constr = ConfigurationManager.ConnectionStrings["Q_SS_regnConnectionString1"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand sq = new SqlCommand("DELETE FROM Booking where Id='" + id + "'", con);
sq.ExecuteNonQuery();
con.Close();
}
}