Gridview + RadioButtons + Paging losing state

R

Roel

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" >
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<vs:GroupRadioButton id="selectRadioButton" runat="server"
AutoPostBack="true" GroupName="event" />
</ItemTemplate>
<HeaderTemplate>
</HeaderTemplate>
</asp:TemplateField>
<asp:BoundField DataField="seqevent" HeaderText="Primary Key"
SortExpression="seqevent" />
<asp:BoundField DataField="eventName" HeaderText="Name"
SortExpression="eventName" />
</Columns>
</asp:GridView>

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

}


I also use http://www.thecodeproject.com/aspnet/How_group_RButtons.asp for
radiobutton grouping, otherwise i could select multiple radiobuttons in one
page.

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 =
(Sf.BL.Navigation.GroupRadioButton)Page.FindControl(selecteditem);
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,
Roel
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top