Reputation: 3
Protected Sub View_click(ByVal sender As Object, ByVal e As EventArgs)
Dim id As Integer = Integer.Parse(TryCast(sender, LinkButton).CommandArgument)
Dim lsfilename As String
Dim lsfilepath As String
Dim savePath As String = "c:/Users/Administrator.VCIDEX3/Downloads"
Dim embed As String = "<object data=""{0}"" type=""application/pdf"" align=""center"" width=""500px"" height=""600px"">"
embed += "</object>"
objdbconn.OpenConn()
msSQL = "select Id,FileName,FilePath from tblfiles where Id='" & id & "'"
objODBCDataReader = objdbconn.GetDataReader(msSQL)
If objODBCDataReader.HasRows = True Then
objODBCDataReader.Read()
lsfilename = objODBCDataReader.Item("FileName").ToString
lsfilepath = objODBCDataReader.Item("FilePath").ToString
End If
msSQL = " select * from tblfiles where id='" & id & "' "
ltEmbed.Text = String.Format(embed, ResolveUrl("'" & savePath & "' /q.pdf"))
objdbconn.CloseConn()
End Sub
<asp:Literal ID="ltEmbed" runat="server" />
here I tried to view a PDF file using literal, the code is executed and I got
c:/Users/Administrator.VCIDEX3/Downloads/q.pdf
correctly but the file is not shown.
Upvotes: 0
Views: 55
Reputation: 54417
You have two parameter placeholders in your text, i.e. {0} and {1}, but you only provide one value, i.e. the result of ResolveUrl
. If the text is expecting two values to be replaced then you need to provide two values.
Upvotes: 1