question

AnjaliAgarwal-1903 avatar image
0 Votes"
AnjaliAgarwal-1903 asked YijingSun-MSFT commented

Retaining the values of web form controls when back button is clicked

I have several radio button list on my page and inside each list, I have several list items. I need to retrieve the radio button values when the back button is clicked. One way, I can do this store the values in session variables, but I was wondering if there is any easier way to store the values and then retrieve them when back button is clicked. All these radio button list are inside the Update panel and Content template.


 <asp:UpdatePanel ID="updatePanel1" runat="server">
             <ContentTemplate>
  <asp:RadioButtonList CssClass="radioBL"  ID="rdbRiver" runat="server" OnSelectedIndexChanged="rdbRiverside_indexchanged" AutoPostBack="true" >
                                 <asp:ListItem Value="Yes">Yes</asp:ListItem>
                                 <asp:ListItem Value="No">No</asp:ListItem>
              </asp:RadioButtonList>
  <ContentTemplate>
  </updatePanel>
    
 any help will be greatly appreciated
dotnet-aspnet-webforms
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hum, I can only suggest that you provide the button to go back, or some button like done, or maybe submit. That way, you can pick up the values. But passing back to the previous page? Well, you need to use session() anyway, or add parameters to the URL when you navigate (and again, that means your button to navigate, and not the build in one.
I suppose on web browser navagate back you could also call a ajax routine (web method), and pass the values, and then put in them in session(). So, even if you were to say write some client side code (JavaScript), you probably would wind up using session anyway.

0 Votes 0 ·

Hi @AnjaliAgarwal-1903 ,

What's your purpose to store the radio button list? If you want to save it and search something based on the item value on the other page,you must to use session. It's more easier. However, if you only need to get and save the item value on the self page,you could save it in the hidden field.

0 Votes 0 ·

0 Answers