Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with DropDownList and ViewState

Status
Not open for further replies.

Sheffield

Programmer
Jun 1, 2001
180
US
Greetings,

PROBLEM: I'm having difficulty removing a specific item from a DropDownList. In essence, I want to 'refresh' the DropDownList to exclude SelectedItems that have been deleted. Ideally, back to the first item in the list.

After successfully populating a DropDownList with the results from a database query AND then successfully deleting one of those records, I'm having difficulty removing that specific record I deleted from the DropDownList.

If I call the procedure that originally loaded the DropDownList, it will only ADD the new query results to the existing DropDownList items.

I thought I could set the
Code:
EnableViewState
property to FALSE right before the procedure call and then to TRUE immediately after, but it had no effect.

Any ideas for this ASP.net newbie?

Thanks:)
 
Add a Clear statement to the begining of the fill procedure.

Me.lstListing.Items.Clear()

Then you will refill with the new dataset.

Hope everyone is having a great day!

Thanks - Jennifer
 
If you're refreshing the data every time, you can simply leave the ViewState off.

Where do you call the remove function?

ddlMyList.Items.RemoveAt(/*some int index*/);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top