Solved

Asp.net refresh DropDownList

Posted on 2010-09-02
5
770 Views
Last Modified: 2012-05-10
I have an Asp.net page with several DropDownLists.
When the user selects an item from the list, it redirects him to another page.
If the user clicks the browser's back button, the item is still selected in the DropDownList.
How do I make it so that when he goes back to that page, the DropDownList is reset?
0
Comment
Question by:Rick
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:urir10
ID: 33591617
try to add that to your aspx page that has the drop down on it:

<meta http-equiv="expires" content="-1">
0
 
LVL 13

Author Comment

by:Rick
ID: 33596355

Where?

 


<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage2.master" AutoEventWireup="false" CodeFile="MainPage.aspx.vb" Inherits="_Default" %> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"> 

<table align="center" cellspacing="10" class="style33"> 
<tr> 
<td class="style35"> 
<asp:Image ID="imgCreation" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/address-book-2.png" ToolTip="Creation" /> 
&nbsp; Creation</td> 
<td class="style37"> 
<asp:Image ID="imgMaintenance" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/under-construction.png" ToolTip="Maintenance" /> 
&nbsp; Maintenance</td> 
</tr> 
<tr> 
<td class="style34"> 
<asp:DropDownList ID="drpCreation" runat="server" AutoPostBack="True" 
Width="450px"> 
</asp:DropDownList> 
</td> 
<td> 
<asp:DropDownList ID="drpMaintenance" runat="server" Width="450px"> 
</asp:DropDownList> 
</td> 
</tr> 
</table> 
<br /> 
<table align="center" cellspacing="10" class="style33"> 
<tr> 
<td class="style35"> 
<asp:Image ID="imgFunding" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/calc.png" ToolTip="Funding" /> 
&nbsp; Funding</td> 
<td class="style37"> 
<asp:Image ID="mgDistribution" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/anchor.png" ToolTip="Distribution" /> 
&nbsp; Distribution</td> 
</tr> 
<tr> 
<td class="style34"> 
<asp:DropDownList ID="drpFunding" runat="server" Width="450px"> 
</asp:DropDownList> 
</td> 
<td> 
<asp:DropDownList ID="drpDistribution" runat="server" Width="450px"> 
</asp:DropDownList> 
</td> 
</tr> 
</table> 
<br /> 
<br /> 
<table align="center" cellspacing="10" class="style33"> 
<tr> 
<td class="style35"> 
<asp:Image ID="imgInventory" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/adress-book.png" ToolTip="Inventory" /> 
&nbsp; Inventory</td> 
<td class="style37"> 
<asp:Image ID="imgReports" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/folder-open.png" ToolTip="Reports" /> 
&nbsp; Reports</td> 
</tr> 
<tr> 
<td class="style34"> 
<asp:DropDownList ID="drpInventory" runat="server" Width="450px"> 
</asp:DropDownList> 
</td> 
<td> 
<asp:DropDownList ID="drpReports" runat="server" Width="450px"> 
</asp:DropDownList> 
</td> 
</tr> 
</table> 
<br /> 
<br /> 
<table align="center" cellspacing="10" class="style33"> 
<tr> 
<td class="style35"> 
<asp:Image ID="imgUtilities" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/magnet.png" ToolTip="Utilities" /> 
&nbsp; Utilities</td> 
<td class="style37"> 
<asp:Image ID="imgEuJpReports" runat="server" ImageAlign="AbsMiddle" 
ImageUrl="~/img/Icons/folder-open.png" ToolTip="Eu and JP Reports" /> 
&nbsp; Eu and JP Reports</td> 
</tr> 
<tr> 
<td class="style34"> 
<asp:DropDownList ID="drpUtilities" runat="server" Width="450px"> 
</asp:DropDownList> 
</td> 
<td> 
<asp:DropDownList ID="drpEuJpReports" runat="server" Width="450px"> 
</asp:DropDownList> 
</td> 
</tr> 
</table> 
</asp:Content> 
<asp:Content ID="Content3" runat="server" contentplaceholderid="head"> 

<style type="text/css"> 
a {font-family:Arial;} 
a:link {text-decoration: none; color:blue;} 
a:visited {text-decoration: none; color:blue;} 
a:hover {text-decoration: none; color:black} 
a:active {color:black;text-decoration: none} 
.style5 
{ 
margin-left: 24px; 
font-weight: normal; 
} 
.style33 
{ 
width: 910px; 
} 
.style34 
{ 
width: 416px; 
} 
.style35 
{ 
width: 416px; 
font-weight: bold; 
font-family: Arial, Helvetica, sans-serif; 
color: #FFFFFF; 
font-size: large; 
text-align: left; 
background-color: #336699; 
} 
.style37 
{ 
font-family: Arial, Helvetica, sans-serif; 
font-weight: bold; 
color: #FFFFFF; 
font-size: large; 
text-align: left; 
background-color: #336699; 
} 
</style> 
</asp:Content> 
  

  
  
  
  
  

Open in new window

0
 
LVL 7

Expert Comment

by:urir10
ID: 33596369
just under the <%@ Page  tag and before the <asp:Content  tag
0
 
LVL 13

Accepted Solution

by:
Rick earned 0 total points
ID: 33596928
I tried that, but it gives me a "Content is not supported outside 'script' or 'asp:content' regions.
I also tried putting it here:

<asp:Content ID="Content3" runat="server" contentplaceholderid="head">

<meta http-equiv="expires" content="-1" />

<style type="text/css">
a {font-family:Arial;}
.....
 
... but it didn't work. No error messages. But it didn't work at run time.
 
Thanks,
Rick
0
 
LVL 13

Author Closing Comment

by:Rick
ID: 33621657
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.net Fit image buttons according to size of the screen 2 20
Delete HTML table rows 12 29
jquery datatables, asp.net MVC 9 41
asp enable view state 1 24
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question