Professional Web Applications Themes

Saving selectedIndex state for subclass of RadioButtonList - ASP.NET Building Controls

I am new to building custom controls. I have subclassed RadioButtonList to provide a rollover effect where I can provide details on each option. I am having trouble saving the state of the selectedIndex. When I post back the currently selected option is lost. I am digging into various references on building custom controls, but if someone can provide information on what I need to do so that on post backs the selected option still shows I would greatly appreciate it. Jay...

  1. #1

    Default Saving selectedIndex state for subclass of RadioButtonList

    I am new to building custom controls. I have subclassed RadioButtonList to provide a rollover effect where I can provide details on each option. I am having trouble saving the state of the selectedIndex. When I post back the currently selected option is lost. I am digging into various references on building custom controls, but if someone can provide information on what I need to do so that on post backs the selected option still shows I would greatly appreciate it.

    Jay
    Jay Guest

  2. #2

    Default Re: Saving selectedIndex state for subclass of RadioButtonList

    Have you tried:

    ViewState["SelectedValue"] = myRbl.SelectedIndex;

    and

    myRbl.SelectedIndex = (int)ViewState["SelctedValue"];

    Save it any time you have it locked down in code after OnInit, and retrieve
    it anytime after OnInit on postback.

    Dale Preston
    MCAD, MCSE, MCDBA

    "Jay" <mesomewhere.com> wrote in message
    news:OY8VHErcEHA.2164TK2MSFTNGP10.phx.gbl...
    I am new to building custom controls. I have subclassed RadioButtonList to
    provide a rollover effect where I can provide details on each option. I am
    having trouble saving the state of the selectedIndex. When I post back the
    currently selected option is lost. I am digging into various references on
    building custom controls, but if someone can provide information on what I
    need to do so that on post backs the selected option still shows I would
    greatly appreciate it.

    Jay


    Dale Guest

Similar Threads

  1. Saving 3D object state
    By mindylim in forum Macromedia Director 3D
    Replies: 1
    Last Post: March 1st, 10:37 AM
  2. Saving provider state?
    By dotnet_vb_newbie@programmer.net in forum ASP.NET Building Controls
    Replies: 0
    Last Post: November 3rd, 01:12 PM
  3. Saving the state of a movie
    By Ali Foote in forum Macromedia Flash
    Replies: 2
    Last Post: April 17th, 11:23 AM
  4. Saving Session state with soap in ASP
    By Steve Kuhn in forum ASP.NET Web Services
    Replies: 0
    Last Post: July 31st, 03:08 PM
  5. Setting a default state for Multi-State buttons
    By Taylor3d webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 1
    Last Post: July 14th, 01:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139