aspx page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pupilstuff
    New Member
    • Jun 2009
    • 18

    aspx page

    hi guys i am using this code in my aspx page

    <%for (int i=o;i<5;i++)
    {%>
    <asp: link button id=i text=i/>

    <%}%>

    at it producing five link buttons like
    i i i i i

    but i just want five link buttons like that

    1 2 3 4 5
    with id=1,2,3,4,5 respectively

    how can I can implement that
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I don't think you're allowed to add ID's the way you are.
    Try not adding an ID to the button.
    It might be added automatically for you by ASP.NET.

    Comment

    • pupilstuff
      New Member
      • Jun 2009
      • 18

      #3
      no,its working but in the different manner

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Could you please elaborate on that?

        Comment

        • programmerboy
          New Member
          • Jul 2007
          • 84

          #5
          Try this and see if it works

          <%
          for (int i=o;i<5;i++)
          {
          %>
          <asp: link button id="<%=i+1%>" text="<%=i+1%>"/>
          <%
          }
          %>

          If it doesn't work then you can programmaticall y add controls in your code behind file.

          Comment

          • maliksleo
            New Member
            • Feb 2009
            • 115

            #6
            you can generate link buttons on runtime but there may be some problem in their click events. Please give the detailed picture of your senerio for better understandings.

            maliksleo

            Comment

            Working...