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

  • SEARCH
  • Home
  • 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 7966919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:33:40+00:00 2026-06-04T06:33:40+00:00

I have a repeater control with item template like this: <ItemTemplate> <table width=70%> <tr

  • 0

I have a repeater control with item template like this:

 <ItemTemplate>
                    <table width="70%">
                        <tr id="rowSIC" runat="server">
                            <td width="10%">
                                <asp:Label ID="lblsSICCode" runat="server" Text='<%# Eval("SICCode") %>'></asp:Label>
                            </td>
                            <td width="70%">
                                <asp:Label ID="Label2" runat="server" Text='<%# Eval("IndustryName") %>'></asp:Label>
                            </td>
                            <td width="10%">
                                <asp:LinkButton ID="lnkSelect" runat="server" CommandArgument='<%# Eval("SICCode") %>'
                                    CommandName="MyUpdate">Select</asp:LinkButton>
                            </td>
                            <td width="10%">
                                <asp:Label ID="Label1" runat="server"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>

and itemCommand event where I am changing the repeater row color and saving its id in viewstate like this:

Protected Sub Repeater1_ItemCommand(source As Object, e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles Repeater1.ItemCommand
        If e.CommandName.Equals("MyUpdate") Then
            Dim MyLabel As Label = TryCast(e.Item.FindControl("lblsSICCode"), Label)
            Dim Label1 As Label = TryCast(e.Item.FindControl("Label1"), Label)
            Dim rowSIC As HtmlTableRow = TryCast(e.Item.FindControl("rowSIC"), HtmlTableRow)

            If MyLabel IsNot Nothing Then
                ' Label1.Text = MyLabel.Text
                rowSIC.BgColor = "#FFDAB9"
                ViewState.Add("selectedItem", MyLabel.Text)
            End If
        End If
    End Sub

I have a treeview on this page of which each node has and Id and value. on selected node change event, I want to change the text of repeater selected node. I am writing code like this:

Protected Sub TreeView1_SelectedNodeChanged(sender As Object, e As System.EventArgs) Handles TreeView1.SelectedNodeChanged

    Dim EmployeeRepeater As Repeater = CType(Me.Form.Controls(1).FindControl("Repeater1"), Repeater)
    Dim EmployeeRepeaterItem As RepeaterItem
    Dim EmployeeName As Label

    For Each EmployeeRepeaterItem In Repeater1.Items

        Dim MyLabel As Label = TryCast(EmployeeRepeaterItem.FindControl("lblsSICCode"), Label)
        EmployeeName = CType(EmployeeRepeaterItem.FindControl("Label1"), Label)

        If ViewState("selectedItem") = TreeView1.SelectedValue Then
            EmployeeName.Text = TreeView1.SelectedNode.Text
        End If


    Next

End Sub

But It is not chagging MyLabel text. How to fix it ?

Both treeview and repeater are populated in !Page.Ispostback event

Regards,
Asif Hameed

  • 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-06-04T06:33:41+00:00Added an answer on June 4, 2026 at 6:33 am

    In the method,

    TreeView1_SelectedNodeChanged(sender As Object, e As System.EventArgs)

    You never set the value of MyLabel.

    You should have something like MyLabel.Text = “Hello”;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a repeater control: <table style=width: 100%> <asp:Repeater runat=server ID=rptOptions OnItemDataBound=rptOptions_ItemDataBound> <HeaderTemplate> <tr>
I have repeater with item template: <asp:Repeater ID=queryParametersRepeater runat=server DataSourceID=queryParametersObjectDataSource> <ItemTemplate> <tr class=itemTemplate> <td
I have a Repeater control in my aspx page: <asp:Repeater ID=repeater runat=server EnableViewState=false> <ItemTemplate>
I have Repeater Control and in that i have code like this <div runat=server
Using VS 2008, I have a Repeater control: <asp:Repeater runat=server ID=storesRep DataSourceID=storeSqlDataSource OnItemDataBound=StoresRep_ItemDataBound> <ItemTemplate>
I have Repeater Control as shown below. <asp:Repeater ID=rptCategory runat=server> <HeaderTemplate> <h2 class=art-logo-text style=margin-bottom:
Greetings! I have a Repeater control that's using an XmlDataSource control. <asp:FormView id=myFormView runat=server
I have a asp.net repeater control in a aspx page, with runat=server and an
I have the following repeater code: <asp:Repeater ID=repMain runat=server OnItemCommand=repMain_ItemCommand EnableViewState=false> <ItemTemplate> <dmg:testcontrol runat=server
I have a repeater that is looping a user control, like this: <asp:Repeater ID=repItems

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.