asp.net - How to get radio buttons (list items) to stay selected during postback -


basically have radiobuttonlist in updatepanel, inside of updatepanel. once select item in list unselect itself, of course triggered postback. now, nothing in codebehind anywhere changing selected property of radiolist. now, assumed viewstatemode= enabled, selected index preserved between postbacks. happens when item selected, becomes unselected.

my inner(nested) updatepanel code looks this.

     <asp:updatepanel id="optionsupdater" updatemode="conditional" runat="server" childrenastriggers="true" viewstatemode="enabled">       <contenttemplate>                <asp:panel runat="server" id="rightside" cssclass="column4 row2">                         <%--options panel--%>                         <div id="optionspanel">                             <div style="padding: 2px; border-color: black; border-style: solid; border-width: 1px; background-color: white; position: relative; top: -45px; left: -40px; border-radius: 8px;">                                 <p class="bluegradientbg3 massheader"                                     style="margin-left: -5px; min-width: 305px; font-size: 1.5em; border-radius: 14px; font-family: arial; text-align: center">                                     options                                 </p>                                 <asp:radiobuttonlist id="optionsradiolist" runat="server"                                     height="120px" width="269px"                                     autopostback="true"                                     cellpadding="9"                                     cellspacing="2"                                     viewstatemode="enabled"                                     >                                     <asp:listitem value="update">update existing parts</asp:listitem>                                     <asp:listitem value="add">add new parts</asp:listitem>                                     <asp:listitem value="delete">mass delete</asp:listitem>                                 </asp:radiobuttonlist>                                 <asp:checkboxlist id="optionschecklist" runat="server" height="100px" width="269px"                                     onselectedindexchanged="optionschecklist_selectedindexchanged">                                     <asp:listitem value="ntds">update ntds only</asp:listitem>                                     <asp:listitem value="addpart">add part if none assigned</asp:listitem>                                     <asp:listitem value="changelocations">change n/a locations selected</asp:listitem>                                 </asp:checkboxlist>                     </asp:panel>                 </contenttemplate>               </asp:updatepanel> 

and outer updatepanel way in code looks this:

 <asp:updatepanel id="overallupdater" updatemode="conditional" runat="server" childrenastriggers="true">      <contenttemplate>            //content omitted brevity         </contenttemplate>         <triggers>             <asp:asyncpostbacktrigger controlid="viewapps" eventname="click" />             <asp:asyncpostbacktrigger controlid="updatebutton" eventname="click" />             <asp:asyncpostbacktrigger controlid="filterbutton" eventname="click" />             <asp:asyncpostbacktrigger controlid="optionsradiolist" eventname="selectedindexchanged" />          </triggers>     </asp:updatepanel>   

in postback, setting data source of radiobuttonlist? if so, that's what's resetting it.

if want load datasource rbl first time page loads user, put inside conditional this:

if(!ispostback) {     // load rbl data } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -