If you are using ItemTemplate in your gridView then you need to enable "RowDataBound" inside properties pane ->Events.
Steps to execute Javascript function.
1.Javascript function in your aspx page
function fnPopUp(viewDetails) {
alert(viewDetails);
}
2. Create templateField :
<asp:TemplateField HeaderText="View Information">
<ItemTemplate>
<asp:LinkButton ID="lnkDisplayPopUp" runat="server"
Text='<%# Eval("ColumnName") %>' onclick="lnkDisplayPopUp_Click" ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
3. In events inside properties Pane of GridView RowDataBound specify (GridView_RowDataBound) name of the function which is created behind GridView code file .
3. Write This Code.In order to register your onclick event.
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton btnAlert = (LinkButton)e.Row.FindControl("lnkDisplayPopUp");
DataRowView drv = (DataRowView)e.Row.DataItem;
string id = drv["ColumnName"].ToString();
btnAlert.Attributes.Add("onclick", "fnPopUp("+id+");return false;");
}
}