rickyvalkier dddd

rickyvalkier dddd

  • NA
  • 10
  • 8.7k

add foreach item to asp:label

Sep 14 2016 11:29 AM
hi, 
 
in my aspx file ive got the following code:
  1. <table>  
  2. <% foreach (var number in Numbers)  
  3.     { %>  
  4.      <tr>  
  5.     <td><%= number %>   <asp:Label ID="alternatenumberLabel" runat="server" CssClass="label-xxxl" Text="<%= number %>"  ></asp:Label></td>  
  6.     <td><asp:Button ID="Button" runat="server" CommandName="Submit" Text="> Wijzigen"  
  7.     UseSubmitBehavior="false" CssClass="button" OnClick="EditButton_Click" ValidationGroup="EditUserGroup" /></td>  
  8.     </tr>  
  9. <% } %>  
  10. </table>  
 when I run the code the <td><%= number %>  part shows the result of the foreach item. However the asp:label text is shown as plain text instead of getting the value, and I need to put it on a label, so can somebody tell me what  i'm doing wrong so I can just show only a label that contains the foreach iten and the button. so withoud the first part <td><%= number %> .
 
thnx guys 

Answers (3)