Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 282347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:16:52+00:00 2026-05-12T05:16:52+00:00

I have following code in page load Protected Sub Page_Load(ByVal sender As Object, ByVal

  • 0

I have following code in page load

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            GetDetails()
            PopulateRepeater()
        End If
    End Sub

Sub PopulateRepeater()
        Dim dt As DataTable = GetDetails()
        Dim dtDoc As DataTable = objdoc.GetDocDetails(Session("RegID"))
        If dtDoc.Rows.Count > 0 Then
            Dim strUserName As String = dt.Rows(0)("Name")
            Dim files As IList(Of FileInfo) = New List(Of FileInfo)()
            Dim filters As String = "*.jpg;*.png;*.gif"
            For Each filter As String In filters.Split(";"c)
                Dim fit As FileInfo() = New DirectoryInfo(Me.Server.MapPath("../SiteImages/" & strUserName & "/" & Session("RegID") & "/")).GetFiles(filter)
                For Each fi As FileInfo In fit
                    files.Add(fi)
                Next
            Next
            strPath = Server.MapPath("../SiteImages/" & strUserName & "/" & Session("RegID") & "/")
            Me.Repeater1.DataSource = files
            Me.Repeater1.DataBind()
        End If

        End Sub

I have following code in itemdatabound

Dim ThViewr As Bright.WebControls.ThumbViewer = DirectCast(e.Item.FindControl("Th1"), Bright.WebControls.ThumbViewer)
        Dim dtUser As DataTable = GetDetails()
        Dim dtDoc As DataTable = objdoc.GetDocDetails(Session("RegID"))
        Dim strUserName As String = dtUser.Rows(0)("Name")
        If dtDoc.Rows.Count > 0 Then
            For i As Integer = 0 To dtDoc.Rows.Count - 1
                Dim ImagePath As String = "../SiteImages/" & strUserName & "/" & Session("RegID") & "/" + dtDoc.Rows(i)("ImageName")
                ThViewr.ImageUrl = ImagePath
            Next

        End If

My aspx contains

<div style="clear:both;">
                <asp:Repeater ID="Repeater1" runat="server" >
                    <ItemTemplate>
                        <span style="padding:2px 10px 2px 10px">

                            <bri:ThumbViewer Id="Th1"  runat="server" Height="100px" Width="100px"/>
                        </span>
                    </ItemTemplate>
                </asp:Repeater>
            </div> 

If the imagePath =”../SiteImages/Ram/PR/First.jpg” Means the folder PR aontains exactly 3 images namely First.jpg,Second.jpg and Third.jpg.

Now with above code three images are coming but Third.jpg is repeating 3 times.First.jpg and Second.jpg is not coming.Can anybody help to resolve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:16:52+00:00Added an answer on May 12, 2026 at 5:16 am

    The ItemDataBound event is raised once for every object in the bound list, so it will be fired three times in your case; once for each file. You should not loop over your data table, but rather grab the current item from the event args.

    Update: looking closer at the code I find it somewhat confusing. You bind a list of FileInfo objects to the repeater, but fetch data from a DataTable when the items are bound. I am guessing that you want to show the files found, and I think that the following code in ItemDataBound will do that for you:

    Dim ThViewr As Bright.WebControls.ThumbViewer = DirectCast(e.Item.FindControl("Th1"), Bright.WebControls.ThumbViewer)
    Dim dtUser As DataTable = GetDetails()
    Dim strUserName As String = dtUser.Rows(0)("Name")
    Dim ImagePath As String = "../SiteImages/" & strUserName & "/" & Session("RegID") & "/" + DirectCast(e.Item.DataItem, FileInfo).Name
    ThViewr.ImageUrl = ImagePath    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.