Gridview + RadioButtons + Paging losing state



Hi All,

I have a gridview in a wizard where you can select an event in a radio
button for each row in the gridview.
So when you have checked the radiobutton, you would have to press 'next' in
the wizard to advance to the next step.
Problem is that when I enable paging and sorting for the gridview, when I
have selected a radiobutton in e.g. page 1, the selection is not remembered
when paging back to Page 1.

The Gridview looks like this

<asp:GridView ID="gvEvents" runat="server" AutoGenerateColumns="false" >
<asp:TemplateField HeaderText="Select">
<vs:GroupRadioButton id="selectRadioButton" runat="server"
AutoPostBack="true" GroupName="event" />
<asp:BoundField DataField="seqevent" HeaderText="Primary Key"
SortExpression="seqevent" />
<asp:BoundField DataField="eventName" HeaderText="Name"
SortExpression="eventName" />

if (!Page.IsPostBack)
gvEvents.AllowPaging = true;
gvEvents.AllowSorting = true;
gvEvents.AutoGenerateColumns = false;
gvEvents.PageSize = 5;
gvEvents.DataSourceID = "odsEvents";


I also use for
radiobutton grouping, otherwise i could select multiple radiobuttons in one

I also tried to put the selectedcontrol in the sessionstate and resetting
every time, but that does not work either:

selecteditem = (string)Session["event"];
if (selecteditem != null)
radiobutton =
radiobutton.Checked = true;

If I advance to a next step in the wizard, the selected radiobutton is
remembered if I have e.g. selected an item in the first page and going to
the next and previous page.

Any thoughts welcome !

Kind Regards,

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads