Bound Dropdowns, Postback, & Back Button

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
 
G

Guest

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!
***************************
 
M

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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top