For Each Item As

philluk

New member
Joined
Oct 27, 2010
Messages
1
Programming Experience
Beginner
Hi Can any one help with this please, iv never done .net before and Iv been asked to get this website working... it seems the "For Each Item As" is causingt the website errors

http://7evensolutions.com/index.aspx

HTML:
Imports Rocktime
Imports Rocktime.Core
Imports Rocktime.Base

Partial Class Acx_HomePageTicker
    Inherits UserControlExClass

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

        Dim Counter As Integer = 0
        Dim Jobs As New rtJobsClass.JobData
        Dim First As Boolean = True
        Dim Articles As New rtArticlesClass.ArticleData
        Dim TrainingDiary As New rtTrainingCoursesClass.TrainingCourseData
				
        Dim DBStatus As New DBAccess.DBStatusClass
				
        Dim FirstTrainingCourse As Boolean = True
        Dim ScrollerLine As String = ""

				
        txtScrollerText.Text = "<script type=""text/javascript"">" & vbCrLf & vbCrLf & _
            "var pausecontent=new Array()" & vbCrLf & vbCrLf

        ' add the news articles to the scroller
        Articles.DisplayOnHomePage.Value = True
        Articles.Active.Value = True
				

				For Each Item As rtArticlesClass.ArticleData In rtArticlesClass.Search(DBStatus, Articles) 
								
          ' If Counter Mod 5 = 0 Then
              ' If Not First Then
                    'ScrollerLine = ScrollerLine & "';"
                '   txtScrollerText.Text = txtScrollerText.Text & ScrollerLine
              ' End If
              ' ScrollerLine = "	pausecontent[" & Counter / 5 & "]='"
            '   First = False
         '  End If

         ' ScrollerLine = ScrollerLine & Item.DateTime.Value.Date & " - " & Replace(Item.Title.Text, "'", "'") & "...<a href=""/news-detail.aspx?fdArticleId=" & Item.Id.Value & """>read more</a><br /><br />"

            'Counter = Counter + 1

       Next
         'end of news articles part

       ' add a link to the training diary page
        TrainingDiary.Active.Value = True
        TrainingDiary.Date.Value = Now.Date
        TrainingDiary.Date.BetweenDate = DateAdd(DateInterval.Day, 7, Now.Date)
        TrainingDiary.Date.WhereOperator = "BETWEEN"

        If Counter Mod 5 = 0 Then
            If Not First Then
                ScrollerLine = ScrollerLine & "';"
                txtScrollerText.Text = txtScrollerText.Text & ScrollerLine
            End If
            ScrollerLine = "	pausecontent[" & Counter / 5 & "]='"
            First = False
        End If
        Counter = Counter + 1

        'For Each Item As rtTrainingCoursesClass.TrainingCourseData In rtTrainingCoursesClass.Search(DBStatus, TrainingDiary)


            'If FirstTrainingCourse Then
            '    ScrollerLine = ScrollerLine & "This weeks training courses<br />"
            '    FirstTrainingCourse = False
            'End If
            'ScrollerLine = ScrollerLine & Item.Date.Value.Date & " - " & Replace(Item.Title.Text, "'", "'") & "<br />"


       ' Next

        If Not DBStatus.HasRows Then
            ScrollerLine = ScrollerLine & "<a href=""/training-diary.aspx"">Click here to see our training diary of events coming up</a><br /><br />"
        Else
            ScrollerLine = ScrollerLine & "<br />"
        End If
        ' end of training diary page part

        ' add the jobs to the scroller
        Jobs.DisplayOnHomePage.Value = True
        Jobs.Active.Value = True

       ' For Each Item As rtJobsClass.JobData In rtJobsClass.Search(DBStatus, Jobs)

          '  If Counter Mod 5 = 0 Then
           '     If Not First Then
           '         ScrollerLine = ScrollerLine & "';"
            '        txtScrollerText.Text = txtScrollerText.Text & ScrollerLine
            '    End If
            ''    ScrollerLine = "	pausecontent[" & Counter / 5 & "]='"
                First = False
           ' End If

          '  ScrollerLine = ScrollerLine & Item.DateTime.Value.Date & " - " & Replace(Item.Title.Text, "'", "'") & "...<a href=""/apply-for-job.aspx?fdJobId=" & Item.Id.Value & """>read more</a><br /><br />"

          '  Counter = Counter + 1

        'Next
        ' end of jobs part


        If Counter <= 5 Then
            If Counter <> 0 Then
                ScrollerLine = ScrollerLine & "';"
                txtScrollerText.Text = txtScrollerText.Text & ScrollerLine
            End If

            txtScrollerText.Text = txtScrollerText.Text & "pausecontent[1]='<a href=""/news.aspx"">Click here for all News Articles</a>';"
        Else
            ScrollerLine = ScrollerLine & "';"
            txtScrollerText.Text = txtScrollerText.Text & ScrollerLine
        End If

        txtScrollerText.Text = txtScrollerText.Text &  "</script>" & vbCrLf & vbCrLf
 
    End Sub

End Class
 
Back
Top