c# - How to get the value of the last element of property in repeater -
<asp:repeater id="reptservices" runat="server" onitemdatabound="reptservices_onitemdatabound"> <b> <td> <%# eval("applicationsteps") %></td> <td><%# eval("service.servicename") %></td> <td> <b><%# eval("beneficiaryuserunitjob.user.namear") %> </b> </td> <td><%# eval("datecreated") %></td> </b> </asp:repeater>
this repeater filled in c#
reptservices.datasource = new applicationlogic(applicationtype.web).getalloutboxapplication(_currentuserunitjob);
"applicationsteps"property contains many elements,which contains property called submitactiontypeid
image shows:
i want value of submitactiontypeid
exist in last elment of applicationsteps
i asked shall write in <%# eval("applicationsteps") %>
i came different solution you.
if not available modify code behind, still don't need repeater solve.
<% var repeaterdatasource = (dynamic)reptservices.datasource; foreach (var item in repeaterdatasource) {%> <%=item.applicationsteps %> <%}%>
this basic repeater. because of not know data type bind repater, use dynamic type.
you can modify purpose.
<%=item.applicationsteps.last().submitactiontypeid %>
first, debug without adding line. if works fine, add code above , try again.
Comments
Post a Comment