Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everyone!

Can you help me to fix this command that this function will convert my listview details in .txt file yet it calls an error with this line Type 'PageFunction' is not defined so my question is what can be the possible code to change Pagefunction to call the command Thanks in advance

here's my code:

VB
Partial Class GetTextFile
    Inherits System.Web.UI.Page

    Dim pFun As New PageFunction

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If Not pFun.IsUserLoggedIn Then
                Response.Redirect("Login.aspx")
            Else
                Dim dt As New Data.DataTable

                Dim strViewDate As String = String.Empty
                Dim dVDate As DateTime = Now
                Dim strAcctNo As String = String.Empty
                Dim strTelNo As String = String.Empty
                Dim strEmail As String = String.Empty
                Dim strPostDate As String = String.Empty
                Dim dPostDate As DateTime = Now
                Dim strRef As String = String.Empty

                Dim sDelimiter As String = ""
                Dim delimiter As String = ""

                Dim sDateFormat As String = ""

                If Page.Request.Item("delimiter") Is Nothing Then
                    sDelimiter = "tab"
                Else
                    sDelimiter = Page.Request.Item("delimiter").ToString.ToLower
                End If

                If sDelimiter = "comma" Then
                    delimiter = ","
                ElseIf sDelimiter = "tab" Then
                    delimiter = vbTab
                Else
                    delimiter = vbTab
                End If

                If Page.Request.Item("dateformat") Is Nothing Then
                    sDateFormat = Format(CDate(Date.Now.ToShortDateString), "yyyyMMdd")
                Else
                    sDateFormat = Page.Request.Item("dateformat").ToString
                End If

                dt = CType(Session("dt"), Data.DataTable)
Posted
v2
Comments
Member 10033107 24-Jun-13 2:42am    
If Not IsNothing(dt) AndAlso dt.Rows.Count > 0 Then
Dim str As New StringBuilder()

Try
str.Append("Registration Date" & delimiter & "Account No." & delimiter & "Telephone No." & delimiter & "Email Address" & delimiter & "Post Date" & vbCrLf)

For Each oRow As Data.DataRow In dt.Rows
dVDate = oRow("DteStp").ToString
strViewDate = dVDate.ToShortDateString

strAcctNo = oRow("AccountNo").ToString.Trim
strTelNo = oRow("AreaTele").ToString.Trim
strEmail = oRow("EmailAddress").ToString.Trim

dPostDate = oRow("ProcessDate")
If dPostDate <= "01/01/2000" Then
strPostDate = ""
Else
strPostDate = dPostDate.ToShortDateString
End If

str.Append(strViewDate & delimiter & strAcctNo & delimiter & strTelNo & delimiter & strEmail & delimiter & strPostDate & vbCrLf)
Next

Response.Buffer = True
Response.AddHeader("Content-Disposition", "attachment;filename=WIFI_Registrants_" & sDateFormat & ".txt")
Response.ContentType = "text/plain"
Response.Write(str.ToString())
Catch ex As Exception
Response.Redirect("ErrorPage.aspx?id=" & pFun.Set_ErrorMessage(ex.Message, ex.ToString, Request.RawUrl.Trim).ToString, False)
End Try
Else
CloseWindow()
End If
End If
Else
Response.Redirect("Login.aspx")
End If
End Sub
Member 10033107 24-Jun-13 2:43am    
the first comment in this trend was the continuation of my code :)

1 solution

You should import the System.Windows.Navigation namespace to use such type as you did, that is put the following line
VB.NET
Imports System.Windows.Navigation

at the top of your source file.
 
Share this answer
 
Comments
Member 10033107 24-Jun-13 4:37am    
as i put this command Imports System.Windows.Navigation it gets still an error yet there's no message on its pop error cause..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900