Click here to Skip to main content
15,921,884 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I get an error in this code that loads a listview with data, and the data is there - not empty strings or anything. Any ideas?

VB
Partial Class Blank
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim lbl1, lbl2, lbl3 As New Label()

        lbl1 = CType(ListView1.FindControl("OptLabel"), Label)
        TextBox1.Text = lbl1.Text <<<<<<<< nullexception error right here but there is data in the Listview

    End Sub


End Class
Posted
Comments
walterhevedeich 5-Apr-11 2:16am    
We dont do FindControl on the ListView itself. Instead, we do it on every row of the ListView.
Sergey Alexandrovich Kryukov 5-Apr-11 4:23am    
Your tags suck! Do you need Answers? Tag it: VB.NET, ASP.NET.
--SA

1 solution

That might be the route to go .. any links to sample code?

And thanks much for getting back to me on this thread - appreciate!

Cheers,
DC
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900