ghost...
ghost...

Reputation: 1001

asp.net website listbox selectedindex

protected void Page_Load(object sender, EventArgs e)
    {
        Label2.Text = ListBox1.SelectedIndex.ToString();

    }

if label2.text is written in page load then its output is -1

protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Label2.Text = ListBox1.SelectedIndex.ToString();
    }

if i write label2.text in selected index change it returns nothing. please help me out.

Upvotes: 0

Views: 288

Answers (1)

PaulG
PaulG

Reputation: 592

Is autopostback set to true on the listbox?

Upvotes: 1

Related Questions