Hi

I have following issue:
I have a dropdownlist which upon selection feeds a listview with data,
which works fine.
Now I wanted to change the headers (2 labels in the <layouttemplate>
of the listview) when a certain selection is made in the dropdown.
This actually works too, but only if the listview has been
initialized. Otherwise it gives me an error message: "Object reference
not set to an instance of an object."
It kind of makes sense to me, why I get this error message, I just
don't know how to get rid of it.

In the indexchanged event of the dropdown list I have following code:
------------------------------------------------------------------------------------------
 var kontquery = from p in Global.dbc.mySources where p.del == false
select p;
lv.DataSource = kontquery;
((Label)lv.FindControl("lblTitleID")).Text = "ID";
((Label)lv.FindControl("lblTitleDE")).Text = "Name";
------------------------------------------------------------------------------------------
This is the code for one case of the selection (the other cases don't
change any controls).
lv is my listview.

Can I somehow preload the listview in my Page_Load event? Without
actually showing it?

I'm not sure if you need any more information of me. If you do, please
don't hesitate to tell me what you need.

Thanks in advance for your help.

Cheers
Carlo

Reply via email to