Bound Dropdowns, Postback, & Back Button

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

I'm pulling a few records from a table and writing them to a databound
dropdown.

I use:

if ispostback = false then
bindcontrols()
end if

to make sure that it retains the selected value for postback.

That all works fine.

The problem comes in when I choose to delete an item from the list. You can
select an item from the dropdown and press 'delete.' It performs a postback
and the item is deleted. However, if you press the back button after
deleting, the old item is retained in the dropdownlist, even though it was
just deleted.

I've tried using Response.Cache.SetCacheability(HttpCacheability.NoCache)
but that just expired the page. If I refresh the expired page, it brings
back the old values.

Is there a way to fix this?

Thanks.

Matt
 
The first part is fine (ispostback). When you delete items, rebind the
controls using the same bindcontrols method. NOTE that you will have to store
any state of these controls before rebinding (find out which item was
selected, etc.) or you will lose that state.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
The first part is fine (ispostback). When you delete items, rebind the
controls using the same bindcontrols method. NOTE that you will have to store
any state of these controls before rebinding (find out which item was
selected, etc.) or you will lose that state.

Thanks for your suggestions.

Yes, I call bindcontrols() again after the delete. However, I'm not sure
what you mean by storing the state of these controls. How do I go about
doing this?

Thanks.

Matt
 
Back
Top