violette 0 Junior Poster in Training

can anyone help me..how to do a loop in my code here..I want to do a loop for one year only..after another year it will create a new column.
For example when column A already fill with year 2008
and another column B will create fill with year 2009.

Protected Sub repeaterAlert_ItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) Handles repeaterAlert.ItemDataBound
 
        stockCodeheader.Text = " Stock Code "
        plcNameheader.Text = " PLC Name "
        boardheader.Text = " Board "
        sectorheader.Text = " Sector "
        subSectorheader.Text = " Sub Sector "
        yearheader.Text = " Year "
        total.Text = " CR "
 
        '** Declare Session **'
        If Session("tempara1") = "" Then
            CR1 = Double.Parse(e.Item.DataItem("para1").ToString)
        Else
            CR1 = Double.Parse(Session("tempara1"))
        End If
 
        If Session("tempara2") = "" Then
            CR2 = Double.Parse(e.Item.DataItem("para_range1").ToString)
        Else
            CR2 = Double.Parse(Session("tempara2"))
 
        End If
 
        If Session("tempara3") = "" Then
            CR3 = Double.Parse(e.Item.DataItem("para_range2").ToString)
        Else
            CR3 = Double.Parse(Session("tempara3"))
 
        End If
 
        '*********************'
 
        Dim stockCode As Label = CType(e.Item.FindControl("stockCode"), Label)
        If Not IsNothing(stockCode) Then
            stockCode.Text = e.Item.DataItem("stock_code").ToString
        End If
 
        Dim plcName As Label = CType(e.Item.FindControl("plcName"), Label)
        If Not IsNothing(plcName) Then
            plcName.Text = e.Item.DataItem("current_name").ToString
        Else
        End If
 
        Dim board As Label = CType(e.Item.FindControl("board"), Label)
        If Not IsNothing(board) Then
            board.Text = e.Item.DataItem("board_name").ToString
        Else
        End If
 
        Dim sector As Label = CType(e.Item.FindControl("sector"), Label)
        If Not IsNothing(sector) Then
            sector.Text = e.Item.DataItem("sector_name").ToString
        Else
        End If
 
        Dim subSector As Label = CType(e.Item.FindControl("subSector"), Label)
        If Not IsNothing(subSector) Then
            subSector.Text = e.Item.DataItem("sub_sector_name").ToString
        Else
        End If
 
        Dim year As Label = CType(e.Item.FindControl("year"), Label)
        If Not IsNothing(year) Then
            year.Text = e.Item.DataItem("year_id").ToString
        Else
        End If
 
        Dim total1 As Label = CType(e.Item.FindControl("total1"), Label)
        total1.Text = e.Item.DataItem("dso").ToString
        Dim compval As Double = total1.Text
        total1.Text = Math.Round(compval, 2)
 
 
        If CR3 > total1.Text And CR2 < total1.Text Then
 
            total1.Style(HtmlTextWriterStyle.Color) = "orange"
        ElseIf total1.Text < CR1 Then
 
            total1.Style(HtmlTextWriterStyle.Color) = "red"
        ElseIf total1.Text = "" Then
            total1.Text = "N/A"
 
        End If
 
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.