开发者

Help creating textboxes via loop in aspx file

开发者 https://www.devze.com 2022-12-21 14:52 出处:网络
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++)%>

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号