Home > DeveloperSection > Forums > Retriving radiobutton list from session
Royce Roy
Royce Roy

Total Post:134

Points:938
Posted on    November-28-2014 10:26 PM

 ASP.Net Session 
Ratings:


 1 Reply(s)
 534  View(s)
Rate this:

Retriving radiobutton list selection from session. I have a radiobutton list. I want to have what I selected when I return to the page. The radiobutton list is filled from a array of strings

 

Adding selection to the session

 

                  Session["selection"] = RadioButtonList1.SelectedIndex;

page load

 

                    if (!IsPostBack)

                    {

                    RadioButtonList1.SelectedIndex = (string)Session["selection"];

                    }

Not working not sure why



Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Supported
Posted on    November-29-2014 6:43 AM

ListControl.SelectedIndex Property

Gets or sets the lowest ordinal index of the selected items in the list.

Try This:

RadioButtonList1.SelectedIndex = Convert.ToInt32(Session["selection"]);


Don't want to miss updates? Please click the below button!

Follow MindStick