MdotButler
Programmer
I have a task where I need to create a FDF file for a PDF form from a database. In the PageLoad method of the VB CodeBehind I have the database access. I need to then create the variables and access them in the ASPX page. The following is the ASPX code.
The following is the CodeBehind that wil read the database and fill the variables needed in the above code.
I am not asking about the DB access just how to use the variables defined in the codebehind in the ASPX code. I know this must be simple but I have not had to do it before. Any help would be appreciated.
TIA
Mark
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Encounter_P.aspx.vb" Inherits="Encounter_P" %>
<% Response.ContentType = "application/vnd.fdf"%>
%FDF-1.2
1 0 obj
<<
/FDF
<< /Fields
[
<< /V (<%=strC_LocationName%>) /T (C_LocationName)>>
<< /V (<%=strC_LocationAddress1%>) /T (C_LocationAddress1)>>
<< /V (<%=strC_LocationAddress2%>) /T (C_LocationAddress2)>>
<< /V (<%=strC_LocationAddress3%>) /T (C_LocationAddress3)>>
]
/F ([URL unfurl="true"]https://www.xyz.com/TheForm.pdf)[/URL]
>>
>>
endobj
trailer
<</Root 1 0 R>>
%%EOF
Code:
Imports System.Data
Imports System.Data.SqlClient
Partial Class Encounter_P
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'database i/o here
' declare the variables used on the form...
Dim strC_LocationName As String = "Name from DB"
Dim strC_LocationAddress1 As String = "Address 1 from DB"
Dim strC_LocationAddress2 As String = "Address 2 from DB"
Dim strC_LocationAddress3 As String = "CSZ from DB"
End Sub
TIA
Mark