</body>
<script>
function openPDF(path)
{
var opt_windowFeatures = "location=1,status=1,scrollbars=1, resizable=1, width=600, left=670";
try
{
window.open (path, '', opt_windowFeatures);
}
catch (err){}
return false;
}
</script>
</html>
-----------------
asp:GridView ID="GridViewAttachment" runat="server" AutoGenerateColumns="False" SkinID="ListGridViewStyle" DataSourceID="ObjectDataSource1" onRowDataBound=gv_RowBound>
-----------------
Protected Sub RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
Dim link As System.Web.UI.WebControls.HyperLink
Dim _docPath As String = "path to image"
For Each ctrl As System.Web.UI.Control In e.Row.Cells(0).Controls
link = ctrl.FindControl("Hyperlink1")
If (link.Text <> "") Then
Dim dataItem As Object = e.Row.DataItem
Dim Path As String = DataBinder.Eval(dataItem, "Attachment_Path").ToString()
If (Path = "") Then
link.ImageUrl = "Images/noPic.gif"
link.Attributes.Add("OnClick", "alert('There is no attached document');return false;") '
Else
Path = Path.Trim().Replace("\\", "\\\\")
link.Attributes.Add("OnClick", "return openPDF('" + _docPath + Path + "');return false;") ' //openPDF is a javascript function
End If
e.Row.Cells(0).ToolTip = "Click on the PDF icon to open up the document"
End If
Next ctrl
End Sub
Try that and see