Avatar of cimscims
cimscims

asked on 

Dropdownlist retaining the value

I have a dropdownlist with values and a default value as 'Select' which has selectedIndex '0'
When a value is slected from the dropdown, the user will be navigated to another screen.

Problem is when the user click on the Browser back button, the dropdown should not retain the previous value instead i need to reload with the dropdownlist with the default value 'select' as the first option.

Need help. Thanks in advance.
ASP.NET

Avatar of undefined
Last Comment
Imran Javed Zia
ASKER CERTIFIED SOLUTION
Avatar of Imran Javed Zia
Imran Javed Zia
Flag of Pakistan image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of cimscims
cimscims

ASKER

It worked with the below code. Thank You.

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Response.Buffer = true;
                Response.CacheControl = "no-cache";
                Response.AddHeader("Pragma", "no-cache");
            }
        }
You are most Welcome
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo