We help IT Professionals succeed at work.
Get Started

Cant show PValue label inside a repeater.

tjgrindsted asked
Last Modified: 2012-05-10
Hi im new to this so hope someone can help me.
Im not knowing all the things so somethings i need to learn.

I have a problem, im showing some data in a repeater and have made a Count() in my codebehind, but it not showed inside the repeater, if i drag the asp:label outside the repeater i get a value.
I have search google for FindControl AND Repeater, but i dont under stand it...can someone plz. help me with my problem so i can see what to do in my code.

This is my CodeBehind
    Public Sub linqdb()

        Dim DBconn As New GetProductListDataContext()
        Dim Q = _
        From p In DBconn.GetTable(Of Product)() _
        Where p.IsEnabled = "1" _
             Order By p.PName Descending _
        Select p

        MyRep.DataSource = Q
        PValue.Text = Q.ToList.Count()

    End Sub

Open in new window

Here its the PValue i need in my Label, if the label is inside the repeater i get an error:
'PValue' is not declared. It may be inaccessible due to its protection level.
If i drag the label outside the repeater the error go away and it works.

But i need to show the PValue inside the repeater.

My label code inside the repeater is
<span id="" class="">Ialt <asp:label id="PValue" runat="server"/> Produkter</span>

Open in new window

Thx for ur interest.
Watch Question
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE