473,396 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Bound Dropdowns, Postback, & Back Button

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.No Cache)
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
Nov 19 '05 #1
2 1165
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!
***************************

"Matt" wrote:
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.No Cache)
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

Nov 19 '05 #2
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
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris Lane | last post by:
Hi, I have an HTML RESET button and Web Control Button that posts back to the server. Problem is the reset button doesn't work after the postback occurs. Any ideas or suggestions as to why this...
4
by: Jeremy | last post by:
I have an ASPX page with a bunch of System.Web.UI.WebControls.Button controls on it. By default, clicking on any of these causes a Postback. I'd like to have it so that for a couple of these...
10
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
0
by: LeAnne | last post by:
In my ASPX page, I populate the GRID when the user selects an item in the dropdown list. Thus, the data is fetched and the data grid DataBind() method is executed in the PostBack (i.e. IsPostBack...
7
by: Tim_Mac | last post by:
hi, using .net 2.0, i have a web form with lots of textboxes, drop-down-lists etc. There are lots of required field validators and regular expression validators. When i click the 'save' button,...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
4
by: Dan | last post by:
Hi, i'm not sure to understand the difference between refreshing the pagina by clicking on 'refresh' in the browser and a postback. What i think it is: Suppose a page with a form containing a...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.