c# - Retrieve Data from Repeater item -


i have following repeater:

<asp:repeater id="rptleaverequests" runat="server"          onitemdatabound="rptleaverequests_itemdatabound"> <itemtemplate>     <table id="tableitem" runat="server">         <tr>                 <td style="width: 100px;">                     <asp:label id="lbldate" runat="server" text='<%#eval("date", "{0:dd/m/yyyy}") %>'></asp:label>                 </td>                 <td style="width: 100px;">                     <asp:label id="lblhours" runat="server" text='<%#eval("hours") %>'></asp:label>                 </td>                 <td style="width: 200px;">                     <asp:label id="lblperiod" runat="server" text='<%#eval("amorpm") %>'></asp:label>                 </td>                 <td style="width: 200px; font-size:10px;">                     <asp:label id="lblnote" runat="server" text='<%#eval("note") %>'></asp:label>                 </td>                 <td style="50px">                     <asp:radiobuttonlist id="rbtverified" runat="server" >                         <asp:listitem value="1">accept</asp:listitem>                         <asp:listitem value="2">reject</asp:listitem>                     </asp:radiobuttonlist>                 </td>                 <td>                     <asp:textbox id="txtnotes" runat="server" ></asp:textbox>                 </td>             </tr>     </table> </itemtemplate> </asp:repeater> 

am trying loop through each item, find 1 radio button checked. if radio button checked want check value (accept or reject) , retrieve data (eval date,hours etc) , send method add database. can please me out, code far:

protected void btnsubmit_click(object sender, eventargs e) {     foreach (repeateritem item in rptleaverequests.items)             {             } } 

you use <asp:radiobuttonlist> , in code behind , cast radiobutton .
try likes ,

           foreach (repeateritem item in rptleaverequests.items)            {                  var rdblist = item.findcontrol("rbtverified") radiobuttonlist;                 switch(rdblist.selectedvalue)                      {                       case "1":                         //accept                       break;                       case "2":                        //reject                       break;                      }            } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -