I have retrieved a value from a query and need to put it into the Label called "lblViews". Every way I try, it says there is no instance for this object. How do I write/set the text of the label to the query I retrieved in the Page_Load method? Thanks.

I have tried the following:

----
Dim Control1 As Label = Ctype(CelebBio.FindControl("lblViews"), Label)
lblViews.Text = Views
----
CelebBio.lblViews.Text = Views
----

'Views does exist, and writes normally just not to the label inside the repeater. I would hate to have a hidden label outside the repeater and on onLoad set javascript to set the label equal to the hidden label.

Recommended Answers

All 3 Replies

I think you might have to do something about taking the repeater and finding the label in its children or something... I had a problem like this once, but I don't quite remember what I did...

Yeah, that's the part I cannot figure out. It's all done on page_load not in a vb file. Just need to figure out what I need to put. Everything that made sense to me does not work! Thanks though.

I solved this one myself. All I did was make the DataList query two tables and used the value there. If you have questions, PM me and I'll tell you how!

Be a part of the DaniWeb community

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