ali raza

C#, .Net ,Asp.net and my thoughts

how to get multiselected from listbox in asp.net

we Select multiple indices from list boxes . the listbox have propery of GetSelectedIndicdces . Which return all selected indexes .

so code is like 

int[] _SelectedIndexes = lstBlog.GetSelectedIndices();

foreach (int Y in _SelectedIndexes)

 {            Response.Write(this.lstBlog.Items[Y].Text + ” “ + this.lstBlog.Items[Y].Value );

} where lstBlog is name of listbox

One response to “how to get multiselected from listbox in asp.net

  1. Reza Taher March 15, 2007 at 2:08 pm

    I tried the cod on ASP .NET 2.0 and it didn’t work. The _SelectedOndexes is always zero

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: