Click here to Skip to main content
14,733,444 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have a dropdown list which is bound to a gridview. I would like to add a dropdownlist item which, when selected, will default to displaying ALL gridview rows. So I would like as the first dropdown list item "Select ALL Items," have this as the default, and have the gridview display ALL items.

Thank you.
m@dhu 11-Nov-10 23:42pm
So what is your question?

ddl.DataSource = dt.Tables(0)
ddl.DataTextField = "NAME"
ddl.DataValueField = "SNO"
ddl.Items.Insert(0, "Select All")
ddl.SelectedIndex = 0

Then on selected index changed of dropdownlist

If ddl.SelectedIndex = 0 Then
  '''your logic
<br />End If

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900