This way
HTML
<asp:GridView ID="gvDemo" runat="server" AutoGenerateColumns="false" OnRowDataBound = "OnRowDataBound">
<Columns>
<asp:BoundField DataField="Code" HeaderText="Code" />
<asp:BoundField DataField="Name" HeaderText="Name" />
</Columns>
</asp:GridView>
<script type="text/javascript">
function openWindow(code) {
window.open('page.aspx?Code=' + code, 'open_window', ' width=640, height=480, left=0, top=0');
}
</script>
CODE
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[2]{
new DataColumn("Code", typeof(int)),
new DataColumn("Name", typeof(string)) });
dt.Rows.Add(1, "Jake");
dt.Rows.Add(2, "John");
dt.Rows.Add(3, "Micheal");
gvDemo.DataSource = dt;
gvDemo.DataBind();
}
}
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = "openWindow('" + e.Row.Cells[0].Text + "')";
e.Row.Attributes["style"] = "cursor:pointer";
}
}