When you the error as below.
Look at the picture below.
I have Panel declared and compiled successfully.
Panel p1 = (Panel)ListView1.Items[i].FindControl(“Panel1”);
At the same time I have Panel1 declared in Listview as below.
Then what is the reason for “Object reference not set to an instance of an object”??
The problem is the panel is only in <AlternatingItemTemplate> section and not in <ItemTemplate>.
Somehow by looking at the error message itself how can the developers know the panel is not in either <AlternatingItemTemplate> or <ItemTemplate> section?