0

Hellooooo... I want to ask a question!

I have Listview1 and in the SelectedItemTemplate I have ListView2. When i click "Select" The Listview2 shows up... and then when i click it again i want it to hide but, i want it check to check if the ListView2 has items to hide the InsertItemTemplate and if it does not have items to show it... I cannot count the items of the 2nd Listview...

I am using this for ListView1 and it works great:

protected void ListView1_DataBound(object sender, EventArgs e)
    {
        if (ListView1.Items.Count == 0)
        {
            ListView1.InsertItemPosition = InsertItemPosition.LastItem;
        }
        else
        {
            ListView1.InsertItemPosition = InsertItemPosition.None;
        }
    }


protected void ListView1_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
    {
        if (ListView1.SelectedIndex == e.NewSelectedIndex)
        {
            e.Cancel = true;
            ListView1.SelectedIndex = -1;
        }
    }

I created ListView2_DataBound event but it does not work.. How can i use that in Listview2? i tried to use FindControl but this only works if i put my ListView2 both in the ItemTempate and in the SelectedItemTemplate..

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by HinataChan
0

You can't access ListView2 from the item template because it doesn't exist in the item template. What exactly are you trying to do in the ItemTemplate that you are needing to access ListView2 for? I couldn't quite make out what your goal is from your post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.