Gridview + RadioButtons + Paging losing state

Discussion in 'ASP .Net Web Controls' started by Roel, Dec 19, 2005.

  1. Roel

    Roel Guest

    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
     
    Roel, Dec 19, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vinay Joseph Mathew

    Losing Session State on a State Server

    Vinay Joseph Mathew, Aug 10, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    601
    =?Utf-8?B?c29ubnk=?=
    Sep 16, 2004
  2. Carlos
    Replies:
    10
    Views:
    691
  3. Guest

    Gridview and Radiobuttons

    Guest, Apr 28, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    334
    Guest
    Apr 28, 2008
  4. Florian Paulus
    Replies:
    0
    Views:
    533
    Florian Paulus
    Nov 14, 2008
  5. Jason C
    Replies:
    4
    Views:
    688
    Morty Abzug
    Jun 26, 2012
Loading...

Share This Page