asp.net - Checkbox in asp:repeater is always false.How to resolve it? -


i have asp:repeater checkboxes , on button click event need update table in database check box values too. if checkbox checked should inserted value 'y' , 'n' if not. have issue here, whenever click button , checkboxes checked i.e., condotion checkbox.checked in button_click event false. because of postback? ideas? here code.

  <asp:scriptmanager id="scriptmanager1" runat="server">         </asp:scriptmanager>                       <asp:updatepanel id="up_docaccess" runat="server">                  <contenttemplate>                         <table class="table table-hover" id="tbldocaccessroles">         <asp:repeater id="rptdocaccessroles" runat="server" onprerender="rptdocaccessroles_prerender" >          <headertemplate>     <tr class="active" style="font-weight: bold">               <th style="text-align:center" >            role            </th>      <th style="text-align:center">view access</th>      <th style="text-align:center">upload access</th>     </tr>            </headertemplate>          <itemtemplate>                  <tr>                  <td class="checkbox" style="text-align:center" >              <%# eval("doc_roles")%>                    <asp:hiddenfield id="hdndoc_roleseq"  runat="server" value ='<%#eval("role_seq")%>' />                   </td>                  <td style="text-align:center" >                       <asp:checkbox id="cb_viewaccess" runat="server"  />                       <asp:hiddenfield id="hiddenviewaccess"  runat="server" value ='<%#eval("view_access")%>' />                  </td>                 <td style="text-align:center" >                      <asp:checkbox id="cb_uploadaccess" runat="server"  />                       <asp:hiddenfield id="hiddenuploadaccess"  runat="server" value ='<%#eval("upload_access")%>' />                  </td>                 </tr>       </itemtemplate>           </asp:repeater>                             </table>                       <asp:button id="btn_clickfordoc" style="display:none"  runat="server"  />                  </contenttemplate>                  </asp:updatepanel>  <asp:button id="btn_update" class="btn btn-warning btn-s" onclick="btn_update_click" runat="server" text="update access roles" /> 

*button click event

protected sub btn_update_click(sender object, e eventargs)         dim viewaccess string         dim uploadaccess string         dim rolesequence string         each ritem repeateritem in rptdocaccessroles.items             dim checkboxforview checkbox = directcast(ritem.findcontrol("cb_viewaccess"), checkbox)             dim checkboxforupload checkbox = directcast(ritem.findcontrol("cb_uploadaccess"), checkbox)             dim hiddenroleseq hiddenfield = directcast(ritem.findcontrol("hdndoc_roleseq"), hiddenfield)             rolesequence = hiddenroleseq.value             if checkboxforview.checked                 viewaccess = "y"             else                 viewaccess = "n"             end if              if checkboxforupload.checked                 uploadaccess = "y"             else                 uploadaccess = "n"             end if              objtimesystem.updatedocroles(cint(rolesequence), usrid.text, datechg.text, viewaccess, uploadaccess, strerrno, strmesg)           next      end sub 


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -