I am having issues with giving id to a text box in the aspx for
heres my code
<%for (int i = 2; i <= 10; i++)%>
<% {%>
<div id="divPerson<%= i %>">
<label for="txtFirstNameFriend<%= i %>">Friends First Name</label>
<asp:TextBox ID="txtFirstNameFriend<%= i %>" MaxLength="50" runat="server"></asp:TextBox>
<br />
<span id="ValFirstNameFriend<%= i %>" class="ValidationError" style="color:Red" visible="false" runat="server"><p>Please enter your First Name</p></span>
<label for="txtLastNameFriend<%=i %>">Friends Last Name</label>
<br />
<label for="txtEmailAddressFriend<%= i %>">Friends Email Address</label>
<asp:TextBox ID="txtEmailAddressFriend<%= i %>" MaxLength="255" runat="server"></asp:TextBox>
<div style="display:none"><asp:TextBox ID="ValFriend<%=i %>" CssClass="ValFriend<%= i %>" MaxLength="2开发者_如何学C55" runat="server"></asp:TextBox></div>
<br />
</div>
<% } %>
Is there any way of adding in a dynamic id to a textbox created on the aspx file?
Have you seen the repeater control?
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.aspx
精彩评论