i have this grid view. I am using below to get id value, but it is displaying 0 value
int id = 0;
int.TryParse(hfId.Value, out id);
Session["DatakeyValue"] = id;
My code
<asp:GridView ID="gvDetails" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#3366CC" BorderStyle="None"
Font-Names="Century Gothic" Font-Size="x-Small"
Width="100%" Style="margin-bottom: 0px" CssClass="grid">
<Columns>
<asp:BoundField DataField="orderid" HeaderText="S/N" />
<asp:BoundField DataField="purchaseorderno" HeaderText="PO.No" />
<asp:BoundField DataField="pid" HeaderText="Prod.Code" />
<asp:BoundField DataField="description" HeaderText="Desc" />
<asp:BoundField DataField="producttype" HeaderText="Model" />
<asp:BoundField DataField="Quantity" HeaderText="Qty" />
<asp:BoundField DataField="dateordered" HeaderText="Ord.Date" />
<asp:BoundField DataField="dateexpected" HeaderText="Exp.Date" />
<asp:BoundField DataField="deliverydate" HeaderText="Del.Date" />
<asp:BoundField DataField="supplier" HeaderText="Suppliers" />
<asp:BoundField DataField="comment" HeaderText="Comments" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button Text="Details" ID="Inkview" runat="server" OnClick="Inkview_Click" ForeColor="white" BackColor="#FF6600"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button Text="Delete" ID="lnkView1" runat="server" OnClick="Inkview_Click1" ForeColor="white" BackColor="#FF6600"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void Inkview_Click(object sender, EventArgs e)
{
int id = 0;
int.TryParse(hfId.Value, out id);
Session["DatakeyValue"] = id;
Response.Redirect("rrrr.aspx");
}
$(document).on('click', '.view', function () {
$('[id*=hfId]').val($(this).closest('tr').find('td').eq(1).html());
});