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 6583451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:24:40+00:00 2026-05-25T16:24:40+00:00

got a few question here. i just want to get the data from the

  • 0

got a few question here. i just want to get the data from the repeater but i guess my codes isnt enough. Could you help me get the selected value of my repeater and send it to my label?

Imports System.Data
  Imports System.Data.SqlClient
   Partial Class About_ReportBug
Inherits System.Web.UI.Page
Protected _letterFilter As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
        initControls()
    End If

End Sub
Private Sub initControls()
    letters_Bind()
End Sub
Private Sub letters_Bind()
    Dim dt As DataTable
    If Session(Me.ToString() & "_LettersData") Is Nothing Then
        Dim letters As String() = {"A", "B", "C", "D", "E", "F", _
         "G", "H", "I", "J", "K", "L", _
         "M", "N", "O", "P", "Q", "R", _
         "S", "T", "U", "V", "W", "X", _
         "Y", "Z", "All"}
        dt = New DataTable()
        dt.Columns.Add(New DataColumn("Letter", GetType(String)))
        For i As Integer = 0 To letters.Length - 1
            Dim dr As DataRow = dt.NewRow()
            dr(0) = letters(i)
            dt.Rows.Add(dr)
        Next
        Session(Me.ToString() & "_LettersData") = dt
    Else
        dt = DirectCast(Session(Me.ToString() & "_LettersData"), DataTable)
    End If
    rptLetters.DataSource = dt.DefaultView
    rptLetters.DataBind()
End Sub
Private Sub letters_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)

    Dim data As DataRowView = DirectCast(e.Item.DataItem, DataRowView)

    If DirectCast(data(0), String) = _letterFilter Then
        Dim lnkletter As LinkButton = DirectCast(e.Item.FindControl("lnkletter"), LinkButton)
        lnkletter.Enabled = False
    End If
End Sub

Private Sub letters_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs)
    If e.CommandName = "Filter" Then
        Dim repeater As RepeaterItem = Me.rptLetters.Items(e.Item.ItemIndex)
        Dim lnkletter As TextBox = repeater.FindControl("_lnkletter")
        Label1.Text = lnkletter.Text
    End If
End Sub

End Class

my client side

<asp:repeater id="rptLetters" runat="server">
          <itemtemplate>
            <asp:linkbutton id="lnkLetter" runat="server" commandname="Filter" commandargument='<%# DataBinder.Eval(Container, "DataItem.Letter")%>' forecolor ="#8C4510">
              <%# DataBinder.Eval(Container, "DataItem.Letter")%>
            </asp:linkbutton>
          </itemtemplate>
        </asp:repeater>
<br />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
  • 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-25T16:24:41+00:00Added an answer on May 25, 2026 at 4:24 pm

    If label is out the outside scope you can just set it from within ItemDataBound or ItemCommand. e.Item.FindControl will only find controls within your ItemTemplate.

    Label1.Text = "Some Text"
    

    Alternatively you can useNamingContainer to walk up the tree and reference controls outside of the ItemTemplate.

    Dim label1 As Label= DirectCast(
                         e.Item.NamingContainer.FindControl("Label1"), Label)
    label1.Text = "Some Text"
    

    To get the selected item from ItemCommand:

    Protected Sub letters_ItemCommand(ByVal source As Object, 
                                      ByVal e As RepeaterCommandEventArgs) 
                                      Handles rptLetters.ItemCommand
            Dim rpItem As RepeaterItem = Me.rptLetters.Items(e.Item.ItemIndex)
            Dim lnkletter As LinkButton = DirectCast(e.Item.FindControl("lnkletter"),
                                                    LinkButton)
            Label1.Text = lnkletter.Text
    End Sub
    

    You also also missing the OnItemCommand event on the repeater.

    <asp:repeater id="rptLetters" runat="server" OnItemCommand="letters_ItemCommand">
              <itemtemplate>
                <asp:linkbutton id="lnkLetter" runat="server" 
                commandname="Filter"
                commandargument='<%# DataBinder.Eval(Container, "DataItem.Letter")%>'
                forecolor ="#8C4510">
                  <%# DataBinder.Eval(Container, "DataItem.Letter")%>
                </asp:linkbutton>
         </itemtemplate>
    </asp:repeater>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have probem / strange question, i got algorithm with few for loops and
I've got a few controllers here at work that contain methods I can use
I just got floored by a command from my manager, saying that in our
I've just answered a question over here where I said that there is no
A few days back, while writing an answer for this question here on overflow
I want to upload my first APK/app to the Android Market, but I got
A few weeks ago I asked exactly the same question here . At first,
I searched for a few days now but didn't find a solution. So here
I've got few files in resources (xsd files) that i use for validating received
I've got a few methods that should call System.exit() on certain inputs. Unfortunately, testing

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.