You can use like this
<asp:TemplateField HeaderText="Vch/Bill No">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval ("vch") %>' OnClick="LinkButton1_Click"></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="100px" Height="20px" />
<HeaderStyle CssClass="headerstylelist" HorizontalAlign="Center" />
</asp:TemplateField>
and in c#
protected void LinkButton1_Click(object sender, EventArgs e)
{
LinkButton link = (LinkButton)sender;
GridViewRow gv = (GridViewRow)(link.Parent.Parent);
LinkButton CustomerID = (LinkButton)gv.FindControl("LinkButton1");
Session["vchbill"] = CustomerID.Text;
Label lbldate = (Label)gv.FindControl("date");
Label lblparty = (Label)gv.FindControl("party");
Label lblid = (Label)gv.FindControl("idlbl");
Session["date"] = lbldate.Text;
Session["party"] = lblparty.Text;
SqlCommand cmd = new SqlCommand("select voucher from saleitemdata where vch='" + CustomerID.Text + "' and companyname='" + HiddenField1.Value + "'", con);
dr = cmd.ExecuteReader();
if (dr.Read())
{
lblid.Text = dr[0].ToString();
Session["id"] = lblid.Text;
} dr.Close();
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "close", "window.opener.location.href='saleitemvoucherbill.aspx', window.close()", true);
}
beacuse from this you can send session in new page